Skip to content

Commit

Permalink
Add version query param to install page
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed Nov 18, 2024
1 parent 2957848 commit 0e88f75
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions static/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,34 @@

Add some information about your project here.

# Installation
# Install Latest Version

You can use the button below to install the pre-built firmware directly to your device via USB from the browser.

<esp-web-install-button manifest="firmware/firmware.manifest.json"></esp-web-install-button>
<esp-web-install-button
manifest="https://firmware.esphome.io/project-template/project-template/manifest.json">
</esp-web-install-button>

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

<details>
<summary>Install Specific Version</summary>
Version: <input />
</details>

<script>
function setVersion(version) {
document.querySelector('h1#install_latest_version').innerHTML = `Install {{ site.title }} ${version}`;
document.querySelector('esp-web-install-button').manifest = `https://firmware.esphome.io/project-template/project-template/${version}/manifest.json`;
}

document.querySelector('input').addEventListener('change', ev => {
const version = ev.target.value;
setVersion(version);
});
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('version')) {
const version = urlParams.get('version');
setVersion(version);
}
</script>

0 comments on commit 0e88f75

Please sign in to comment.