Merge pull request 'Mods update' (#2) from amiay/hytale-f2p:develop into develop

Reviewed-on: https://git.sanhost.net/sanasol/hytale-f2p/pulls/2
This commit is contained in:
amiay
2026-02-24 16:22:55 +00:00
8 changed files with 268 additions and 19 deletions

View File

@@ -84,7 +84,8 @@ const {
loadInstalledMods,
downloadMod,
uninstallMod,
toggleMod
toggleMod,
getModFiles
} = require('./managers/modManager');
// Services
@@ -187,6 +188,7 @@ module.exports = {
downloadMod,
uninstallMod,
toggleMod,
getModFiles,
saveModsToConfig,
loadModsFromConfig,

View File

@@ -285,6 +285,27 @@ async function toggleMod(modId, modsPath) {
}
}
async function getModFiles(modId) {
try {
const response = await axios.get(`https://api.curseforge.com/v1/mods/${modId}/files`, {
headers: {
'x-api-key': API_KEY,
'Accept': 'application/json'
},
params: {
pageSize: 20,
sortOrder: 'desc'
}
});
return response.data.data;
} catch (error) {
console.error('Error fetching mod files:', error);
return [];
}
}
async function syncModsForCurrentProfile() {
try {
const activeProfile = profileManager.getActiveProfile();
@@ -455,5 +476,6 @@ module.exports = {
syncModsForCurrentProfile,
generateModId,
extractModName,
extractVersion
};
extractVersion,
getModFiles
};