diff --git a/src/common/api.js b/src/common/api.js index c6d27c92a..7aa24b47e 100644 --- a/src/common/api.js +++ b/src/common/api.js @@ -423,6 +423,11 @@ export const getMirrorManifest = async modpackId => { } }; +export const getForgeManifest = () => { + const url = `https://files.minecraftforge.net/net/minecraftforge/forge/maven-metadata.json?timestamp=${new Date().getTime()}`; + return axios.get(url); +}; + export const getMirrorAddon = async fileID => { const url = `${MIRROR_API_URL}/addons/${fileID}.json`; const { data } = await axioInstance.get(url); diff --git a/src/common/reducers/actions.js b/src/common/reducers/actions.js index 738c42098..9d899cb7c 100644 --- a/src/common/reducers/actions.js +++ b/src/common/reducers/actions.js @@ -1919,24 +1919,15 @@ export function processForgeManifest(instanceName) { ); }; - const _getMirrorFiles = async () => { - if (!version) { - log.log('Version info is missed, skip mirror check'); + const _getMirrorManifest = async () => { + if (loader?.projectID == undefined) { + log.log('ProjectID is missed, skip mirror check'); } else { - const mirrorManifestHttp = await getMirrorManifest(version?.projectID); - mirrorManifest = await fse.readJson(mirrorManifestHttp); - - mirrorManifest?.files?.forEach(async v => { - addonsHashmap[v.id] = v; - - const modManifest = await getMirrorAddon(v.id); - - addonsFilesHashmap[v.id] = modManifest; - }); + mirrorManifest = await getMirrorManifest(loader?.projectID); } }; - await Promise.all([_getAddons(), _getAddonFiles(), _getMirrorFiles()]); + await Promise.all([_getAddons(), _getAddonFiles(), _getMirrorManifest()]); let modManifests = []; const optedOutMods = [];