Skip to content

Commit 6227f37

Browse files
authored
Merge pull request #68 from kap1bala/refactor/improve-v1-robustness
Refactor: improve robustness
2 parents 01553ee + c8bd20f commit 6227f37

2 files changed

Lines changed: 43 additions & 42 deletions

File tree

index.htm

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
</head>
1616
<body onload="checkSupported()">
1717
<div id="overlay">
18-
<div id="text"><font size="7">
19-
<b>Web Installer under maintenance</b>
20-
</font>
18+
<div id="text">
19+
<h1>Web Installer under maintenance</h1>
2120
<br> The WLED web installer is currently out of service due to maintenance work and will be back online shortly.
2221
<br><br> In the meantime, you can use the webinstaller provided by Wladi: <a href="https://wled-install.github.io/">https://wled-install.github.io/</a>
2322
</div>
@@ -26,11 +25,30 @@
2625
<div class="main">
2726
<h2>Welcome to the WLED web installer!</h2>
2827

28+
<div id="unsupported" hidden>
29+
Sorry, your browser is not yet supported!<br>
30+
Please try on Desktop Chrome or Edge.<br>
31+
Find binary files here:<br>
32+
<a href="https://github.com/Aircoookie/WLED/releases" target="_blank">
33+
<button class="btn" slot="activate">GitHub Releases</button>
34+
</a>
35+
</div>
36+
2937
<div id="flasher">
3038

3139
<ol>
3240
<li>Plug in your ESP to a USB port. We will install WLED <span id="verstr">0.12.0</span> to it.</li>
33-
<li id="coms">Hit "Install" and select the correct COM port. <a onclick="showSerialHelp()">No device found?</a></li>
41+
<li id="coms">Hit "Install" and select the correct COM port.
42+
<a id="showSerialHelp" onclick="showSerialHelp()">No device found?</a>
43+
<p id="serialHelp" hidden>
44+
You might be missing the drivers for your board.<br>
45+
Here are drivers for chips commonly used in ESP boards:<br>
46+
<a href="https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers" target="_blank">CP2102 (square chip)</a><br>
47+
<a href="https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers" target="_blank">CH34x (rectangular chip)</a><br><br>
48+
Make sure your USB cable supports data transfer.<br><br>
49+
</p>
50+
</li>
51+
3452
<li>Get WLED installed and connected in less than 3 minutes!</li>
3553
</ol><br><br>
3654

@@ -96,23 +114,17 @@ <h2>Welcome to the WLED web installer!</h2>
96114
<input class="radio__input" type="radio" value="debug" name="version" id="debug">
97115
<label class="radio__label" for="debug" id="debug_label">DEBUG</label>
98116
</div>
99-
<br>
100-
<div class="container inst-button">
101-
<esp-web-install-button
102-
id="inst"
103-
manifest=""
104-
>
105-
<button class="btn" slot="activate">Install</button>
106-
</esp-web-install-button><br>
107-
108-
</div>
109-
<br></brY><br>Powered by <a href="https://esphome.github.io/esp-web-tools/" target="_blank">ESP Web Tools</a><br>
117+
<br>
118+
<div class="container inst-button">
119+
<esp-web-install-button id="inst" manifest="">
120+
<button class="btn" slot="activate">Install</button>
121+
</esp-web-install-button><br>
122+
</div>
123+
124+
<br><br>Powered by <a href="https://esphome.github.io/esp-web-tools/" target="_blank">ESP Web Tools</a><br>
110125
CORS proxy by <a href="https://corsfix.com" target="_blank">Corsfix</a><br>
111126
<br><a href="https://github.com/Aircoookie/WLED" target="_blank">GitHub</a>&emsp;<a href="https://kno.wled.ge" target="_blank">kno.wled.ge</a>
112127

113-
<script
114-
type = "text/javascript"
115-
src="script.js"
116-
></script>
128+
<script src="script.js"></script>
117129
</body>
118130
</html>

script.js

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@ function handleCheckbox(manifest, checkboxmanifest, primaryCheckbox) {
4545
}
4646

4747
function resetCheckboxes() {
48-
document.getElementById('ethernet').checked = false;
49-
document.getElementById('ethernet').disabled = false;
50-
document.getElementById('audio').checked = false;
51-
document.getElementById('audio').disabled = false;
52-
document.getElementById('test').checked = false;
53-
document.getElementById('test').disabled = false;
54-
document.getElementById('v4').checked = false;
55-
document.getElementById('v4').disabled = false;
56-
document.getElementById('debug').checked = false;
57-
document.getElementById('debug').disabled = false;
48+
const checkBoxIds = ['ethernet', 'audio', 'test', 'v4', 'debug'];
49+
checkBoxIds.forEach(id => {
50+
const checkbox = document.getElementById(id);
51+
if (checkbox) {
52+
checkbox.checked = false;
53+
checkbox.disabled = false;
54+
}
55+
});
5856
}
5957

6058
function checkSupported() {
@@ -63,20 +61,11 @@ function checkSupported() {
6361
}
6462

6563
function unsupported() {
66-
document.getElementById('flasher').innerHTML = `Sorry, your browser is not yet supported!<br>
67-
Please try on Desktop Chrome or Edge.<br>
68-
Find binary files here:<br>
69-
<a href="https://github.com/Aircoookie/WLED/releases" target="_blank">
70-
<button class="btn" slot="activate">GitHub Releases</button>
71-
</a>`
64+
document.getElementById('flasher').hidden = true;
65+
document.getElementById('unsupported').hidden = false;
7266
}
7367

7468
function showSerialHelp() {
75-
document.getElementById('coms').innerHTML = `Hit "Install" and select the correct COM port.<br><br>
76-
You might be missing the drivers for your board.<br>
77-
Here are drivers for chips commonly used in ESP boards:<br>
78-
<a href="https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers" target="_blank">CP2102 (square chip)</a><br>
79-
<a href="https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers" target="_blank">CH34x (rectangular chip)</a><br><br>
80-
Make sure your USB cable supports data transfer.<br><br>
81-
`;
69+
document.getElementById('showSerialHelp').hidden = true;
70+
document.getElementById('serialHelp').hidden = false;
8271
}

0 commit comments

Comments
 (0)