const config = require("./config") async function getVersionManifest(version) { const mainifestRequest = await fetch(config.launcherManifest.get()) const manifest = await mainifestRequest.json() const component = manifest.versions.find($version => $version.id == version) if (!typeof component == "object") { throw new Error("Unknown version") } return component.url } async function getRequiredJREFor(versionUrl) { const mainifestRequest = await fetch(versionUrl) const manifest = await mainifestRequest.json() return manifest.javaVersion } async function getJREComponentDetails(componentRequested, os) { const mainifestRequest = await fetch(config.allRuntimes.get()) const manifest = await mainifestRequest.json() const component = manifest[os][componentRequested] if (typeof component != "object") { throw new Error("No JRE Component found") } return component } async function getJREComponentManifest(url) { const mainifestRequest = await fetch(url) const manifest = await mainifestRequest.json() return manifest } module.exports = { getVersionManifest, getRequiredJREFor, getJREComponentDetails, getJREComponentManifest }