Skip to content

Commit

Permalink
Get firmware version from latest manifest (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Aug 4, 2024
1 parent 6cbb3f3 commit 09ffc65
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion web.esphome.io/src/install-adoptable/install-adoptable-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,20 @@ class ESPHomeInstallAdoptableDialog extends LitElement {
)} are supported.`,
);
}

const manifestResp = await fetch(
"https://firmware.esphome.io/esphome-web/manifest.json",
);
if (!manifestResp.ok) {
throw new Error(
`Downloading ESPHome manifest failed (${manifestResp.status})`,
);
}
const version = (await manifestResp.json())["version"];

const platformLower = platform.toLowerCase();
const resp = await fetch(
`https://firmware.esphome.io/esphome-web/${platformLower}/esphome-web-${platformLower}.factory.bin`,
`https://firmware.esphome.io/esphome-web/${version}/esphome-web-${platformLower}.factory.bin`,
);
if (!resp.ok) {
throw new Error(
Expand Down

0 comments on commit 09ffc65

Please sign in to comment.