Skip to content

Commit 5b4f0f1

Browse files
authored
Allow version to be specified and added as query param (#173)
1 parent 4cae3dc commit 5b4f0f1

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

static/index.html

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,34 @@
55
</head>
66

77
<body>
8-
<h1>Install Production Firmware</h1>
9-
<esp-web-install-button
10-
manifest="https://firmware.esphome.io/home-assistant-voice-pe/home-assistant-voice/manifest.json"></esp-web-install-button>
8+
<div>
119

12-
<h2>Install Beta Firmware</h2>
13-
<esp-web-install-button
14-
manifest="https://firmware.esphome.io/home-assistant-voice-pe/home-assistant-voice/manifest-beta.json"></esp-web-install-button>
10+
<h1>Install Voice PE Latest Firmware</h1>
11+
<esp-web-install-button
12+
manifest="https://firmware.esphome.io/home-assistant-voice-pe/home-assistant-voice/manifest.json">
13+
</esp-web-install-button>
14+
</div>
15+
<br />
16+
<details>
17+
<summary>Install Specific Version</summary>
18+
Version: <input />
19+
</details>
20+
<script>
21+
function setVersion(version) {
22+
document.querySelector('h1').innerHTML = `Install Voice PE v${version}`;
23+
document.querySelector('esp-web-install-button').manifest = `https://firmware.esphome.io/home-assistant-voice-pe/home-assistant-voice/${version}/manifest.json`;
24+
}
25+
26+
document.querySelector('input').addEventListener('change', ev => {
27+
const version = ev.target.value;
28+
setVersion(version);
29+
});
30+
var urlParams = new URLSearchParams(window.location.search);
31+
if (urlParams.has('version')) {
32+
const version = urlParams.get('version');
33+
setVersion(version);
34+
}
35+
</script>
1536

1637
</body>
1738
<script type="module" src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"></script>

0 commit comments

Comments
 (0)