Skip to content

Commit

Permalink
straigh api getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Proxwian committed Feb 5, 2024
1 parent 05adb42 commit d049474
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
5 changes: 5 additions & 0 deletions src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 5 additions & 14 deletions src/common/reducers/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit d049474

Please sign in to comment.