diff --git a/profiles.js b/profiles.js index 4160af48..58232678 100644 --- a/profiles.js +++ b/profiles.js @@ -224,7 +224,7 @@ exports.profile_manifests = { forge: { name: 'Forge Mod', request_args: { - url: 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions.json', + url: 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json', json: true }, handler: function(profile_dir, body, callback) { @@ -233,33 +233,40 @@ exports.profile_manifests = { try { for (var index in body.promos) { var item = new profile_template(); - var ref_obj = body.promos[index]; + var mcver = index.split('-')[0]; + var forgever = body.promos[index]; item['id'] = index; - item['time'] = ref_obj['modified']; - item['releaseTime'] = ref_obj['modified']; item['type'] = 'release'; item['group'] = 'forge'; - item['webui_desc'] = 'Forge Jar (build {0})'.format(ref_obj['build']); + item['webui_desc'] = 'Forge Jar (build {0})'.format(forgever); item['weight'] = 0; - if (ref_obj['branch']) - item['filename'] = 'forge-{0}-{1}-{2}-installer.jar'.format(ref_obj['mcversion'], ref_obj['version'], ref_obj['branch']); - else - item['filename'] = 'forge-{0}-{1}-installer.jar'.format(ref_obj['mcversion'], ref_obj['version']); - item['downloaded'] = fs.existsSync(path.join(profile_dir, item.id, item.filename)); - item['version'] = ref_obj['mcversion']; - item['release_version'] = ref_obj['version']; - if (ref_obj['branch']) - item['url'] = 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}-{2}/{3}'.format(ref_obj['mcversion'], ref_obj['version'], ref_obj['branch'], item['filename']); - else - item['url'] = 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}/{2}'.format(ref_obj['mcversion'], ref_obj['version'], item['filename']); + item['version'] = index; + item['release_version'] = forgever; - var ver = ref_obj['mcversion'].match(/(\d+)\.(\d+)\.?(\d+)?/); + var ver = mcver.match(/(\d+)\.(\d+)\.?(\d+)?/); - if (parseInt(ver[1]) >= 1 && parseInt(ver[2]) >= 6) - p.push(item); // 1.x major, .6 minor, chosen because 1.6.1 changed the installation process so drastically + if (parseInt(ver[1]) <= 1 && parseInt(ver[2]) <= 5) { + // skip version 1.5.2 and earlier--non installer.jar model not supported workflow + } else if (mcver == '1.10') { + // 1.x major, .10 minor but not .10.2, chosen because url construction + item['filename'] = 'forge-{0}-{1}-{0}-installer.jar'.format(mcver, forgever); + item['url'] = 'http://maven.minecraftforge.net/net/minecraftforge/forge/1.10-{0}-1.10.0/forge-1.10-{0}-1.10.0-installer.jar'.format(forgever); + item['downloaded'] = fs.existsSync(path.join(profile_dir, item.id, item.filename)); + p.push(item); + } else if (parseInt(ver[1]) == 1 && parseInt(ver[2]) >= 7 && parseInt(ver[2]) <= 9) { + // 1.x major, .7-.9 minor, chosen because url construction + item['filename'] = 'forge-{0}-{1}-{0}-installer.jar'.format(mcver, forgever); + item['url'] = 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}-{0}/{2}'.format(mcver, forgever, item['filename']); + item['downloaded'] = fs.existsSync(path.join(profile_dir, item.id, item.filename)); + p.push(item); + } else { + item['filename'] = 'forge-{0}-{1}-installer.jar'.format(mcver, forgever); + item['url'] = 'http://files.minecraftforge.net/maven/net/minecraftforge/forge/{0}-{1}/{2}'.format(mcver, forgever, item['filename']); + item['downloaded'] = fs.existsSync(path.join(profile_dir, item.id, item.filename)); + p.push(item); + } } - } catch (e) {} callback(null, p);