mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
🐛 更换v2地址
This commit is contained in:
parent
b5323c8770
commit
910dd4d19d
3 changed files with 8 additions and 20 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue