| 54 | // 下载并缓存配置文件 |
| 55 | async function downloadConfigFile(filename: string): Promise<void> { |
| 56 | try { |
| 57 | const url = baseRepoURL + filename; |
| 58 | const localPath = path.join(ASSET_PATH, filename); |
| 59 | |
| 60 | const response = await axios.get(url); |
| 61 | fs.mkdirSync(ASSET_PATH, { recursive: true }); |
| 62 | fs.writeFileSync(localPath, JSON.stringify(response.data, null, 2)); |
| 63 | |
| 64 | // 更新缓存 |
| 65 | configCache[filename] = Array.isArray(response.data) ? response.data : []; |
| 66 | } catch (error) { |
| 67 | console.error(`下载配置文件失败: ${filename}`, error); |