|
|
@ -60,11 +60,9 @@ export async function releaseVersion(_req: Request, res: Response) { |
|
|
|
res.json(result); |
|
|
|
res.json(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function _axiosRequestMake(req: Request, res: Response, type: string) { |
|
|
|
async function _axiosRequestMake(req: Request, res: Response) { |
|
|
|
const { apiMeta } = req.body; |
|
|
|
const { apiMeta } = req.body; |
|
|
|
if (type === 'csvUrl' || type === 'excelUrl') { |
|
|
|
|
|
|
|
apiMeta.responseType = 'arraybuffer'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (apiMeta?.body) { |
|
|
|
if (apiMeta?.body) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
apiMeta.body = JSON.parse(apiMeta.body); |
|
|
|
apiMeta.body = JSON.parse(apiMeta.body); |
|
|
@ -111,12 +109,21 @@ async function _axiosRequestMake(req: Request, res: Response, type: string) { |
|
|
|
|
|
|
|
|
|
|
|
export async function axiosRequestMake(req: Request, res: Response) { |
|
|
|
export async function axiosRequestMake(req: Request, res: Response) { |
|
|
|
const { |
|
|
|
const { |
|
|
|
apiMeta: { type } |
|
|
|
apiMeta: { url } |
|
|
|
} = req.body; |
|
|
|
} = req.body; |
|
|
|
if (type === 'csvUrl' || type === 'excelUrl') { |
|
|
|
const isExcelImport = /.*\.(xls|xlsx|xlsm|ods|ots)/; |
|
|
|
return await _axiosRequestMake(req, res, type); |
|
|
|
const isCSVImport = /.*\.(csv)/; |
|
|
|
|
|
|
|
const ipBlockList = /(10)(\.([2]([0-5][0-5]|[01234][6-9])|[1][0-9][0-9]|[1-9][0-9]|[0-9])){3}|(172)\.(1[6-9]|2[0-9]|3[0-1])(\.(2[0-4][0-9]|25[0-5]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){2}|(192)\.(168)(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){2}|(0.0.0.0)|localhost?/g; |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
ipBlockList.test(url) || |
|
|
|
|
|
|
|
(!isCSVImport.test(url) && !isExcelImport.test(url)) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
return res.json({}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isCSVImport || isExcelImport) { |
|
|
|
|
|
|
|
req.body.apiMeta.responseType = 'arraybuffer'; |
|
|
|
} |
|
|
|
} |
|
|
|
return res.json({}); |
|
|
|
return await _axiosRequestMake(req, res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default router => { |
|
|
|
export default router => { |
|
|
|