Skip to content

Commit

Permalink
Update sponsor-installer.html
Browse files Browse the repository at this point in the history
  • Loading branch information
alf45tar authored Oct 5, 2024
1 parent f2e85f6 commit 01a9d08
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions sponsor-installer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<title>Install PedalinoMini™</title>
<style>
div, fieldset, input, select { padding: 5px; font-size: 1em; }
Expand Down Expand Up @@ -32,7 +32,6 @@
</head>
<body>
<div style='display:inline-block;color:#eaeaea;min-width:340px;'>

<h1>PedalinoMini™ Installer</h1>

<div class="pick-variant">
Expand All @@ -49,7 +48,6 @@ <h1>PedalinoMini™ Installer</h1>
<input type="text" id="github-token" placeholder="Enter your token here" style="width: 90%;"/>
</div>

<!-- Dropdown container for boards and versions -->
<div class="dropdown-container">
<label for="board-select">Select Board:</label>
<select id="board-select">
Expand All @@ -62,7 +60,6 @@ <h1>PedalinoMini™ Installer</h1>
</select>
</div>

<!-- Status message element for displaying scanning progress -->
<div id="status-message">Scanning not started.</div>

</br></br>
Expand All @@ -88,7 +85,6 @@ <h1>PedalinoMini™ Installer</h1>
<p>Events:</p>
<pre id="events"></pre>
<script>
// Event listener for the version select dropdown
document.querySelector('#version-select').addEventListener("change", (event) => {
const button = document.querySelector('esp-web-install-button');
button.manifest = event.target.value;
Expand All @@ -108,10 +104,10 @@ <h1>PedalinoMini™ Installer</h1>
<a href="https://esphome.github.io/esp-web-tools/" target='_blank' style='color:#aaa;'>PedalinoMini™ Installer powered by ESP Web Tools</a>
</div>
<script>
const GITHUB_REPO = "pedalino-sponsors/PedalinoMini";
const GITHUB_REPO = "alf45tar/PedalinoMini";
const GITHUB_API_URL = `https://api.github.com/repos/${GITHUB_REPO}/git/refs/tags`;

// Mapping of board keys to their display names
// Existing board mappings...
const boards = {
"esp32doit-devkit-v1": "Esp32 DOIT DevKit v1",
"ttgo-t-eight": "TTGO T-Eight",
Expand Down Expand Up @@ -142,22 +138,6 @@ <h1>PedalinoMini™ Installer</h1>
}
}

// Check if a specific file exists at the given URL
async function checkFileExists(url, token) {
try {
const response = await fetch(url, {
method: 'HEAD',
headers: {
'Authorization': `token ${token}`
}
});
return response.ok;
} catch (error) {
console.error("Error checking file existence:", error);
return false;
}
}

// Populate the board dropdown
function populateBoardDropdown() {
const boardSelect = document.getElementById('board-select');
Expand Down Expand Up @@ -190,8 +170,11 @@ <h1>PedalinoMini™ Installer</h1>
const token = document.getElementById('github-token').value; // Get the token from input field
const tags = await fetchTags(token); // Pass the token to fetchTags

const versionSelect = document.getElementById('version-select');
versionSelect.innerHTML = ''; // Clear existing options
versionSelect.disabled = true; // Disable until options are populated

if (tags.length) {
const versionSelect = document.getElementById('version-select');
versionSelect.disabled = false;
const sortedTags = sortVersions(tags.map(tag => tag.ref.split('/').pop()));
sortedTags.forEach(tag => {
Expand All @@ -200,6 +183,10 @@ <h1>PedalinoMini™ Installer</h1>
option.textContent = tag;
versionSelect.appendChild(option);
});

// Update the manifest for the button to the first version
const button = document.querySelector('esp-web-install-button');
button.manifest = versionSelect.options[0].value;
document.getElementById('status-message').textContent = "Tags fetched successfully.";
} else {
document.getElementById('status-message').textContent = "No tags found.";
Expand All @@ -216,7 +203,6 @@ <h1>PedalinoMini™ Installer</h1>
document.getElementById('status-message').textContent = "Enter your token to fetch tags.";
}
});

</script>
</script>
</body>
</html>

0 comments on commit 01a9d08

Please sign in to comment.