🐛 更换v2地址

This commit is contained in:
bietiaop 2024-11-14 18:41:54 +08:00
parent b5323c8770
commit 910dd4d19d
3 changed files with 8 additions and 20 deletions

View file

@ -10,27 +10,14 @@ import * as LocalURI from './const.js';
* @param {keyof MysURL} base 远程地址
* @param {keyof LocalURI} localBase 本地地址
* @param {string} filename 文件名
* @param {keyof MysURL} newBase 新远程地址
* @returns {Promise<string | null>} 保存路径
*/
export const downloadMysImage = async (
base,
localBase,
filename,
newBase = ''
) => {
export const downloadMysImage = async (base, localBase, filename) => {
base = MysURL[base];
localBase = LocalURI[localBase];
if (!!newBase) {
newBase = MysURL[newBase];
}
const finalPath = path.join(localBase, filename);
let url = `${base}/${filename}`;
let result = await checkFile(url, finalPath);
if (!result && !!newBase) {
url = `${newBase}/${filename}`;
result = await checkFile(url, finalPath);
}
return result;
};