add supported device check for web install fetch

This commit is contained in:
Daniel Micay 2021-07-14 02:11:15 -04:00
parent 37ef8d1502
commit 1636983d1f

View File

@ -140,8 +140,13 @@ async function unlockBootloader(setProgress) {
return "Bootloader unlocked.";
}
const supportedDevices = ["redfin", "bramble", "sunfish", "coral", "flame", "bonito", "sargo", "crosshatch", "blueline"];
async function getLatestRelease() {
let product = await device.getVariable("product");
if (!supportedDevices.includes(product)) {
throw new Error(`device model (${product}) is not supported by the GrapheneOS web installer`);
}
let metadataResp = await fetch(`${RELEASES_URL}/${product}-stable`);
let metadata = await metadataResp.text();