Files

  • Not Found
  • Invalid object requested. SHA must identify a commit or a tree.
Last update 3 years 11 months by Stephen Crane
Filesdata
..
config.json
index.html
info.png
transparency.min.js
index.html
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Configuration</title> <script src="/js/transparency.min.js"></script> <script> function load_config() { fetch('/config').then(function(response) { if (response.status !== 200) { console.log('Error: '+response.status); return; } response.json().then(function(data) { Transparency.render(document.getElementById('config'), data); }); }).catch(function(err) { console.log('Fetch error :-S', err); }); } function save_config() { config = document.getElementById('config'); data = [].reduce.call(config.elements, (data, element) => { if (element.id && element.value) { if (element.type == 'checkbox') { data[element.id] = (element.checked? 1: 0); } else { data[element.id] = element.value; } } return data; }, {}); data['presets'] = Array.from(document.getElementsByClassName("preset")).map((element) => { return { preset: element.value }; }) xhr = new XMLHttpRequest(); xhr.open("POST", '/config', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(JSON.stringify(data, null, " ")); } </script> </head> <body onload="load_config()"> <form id="config"> <fieldset> <legend>Configuration</legend> <table> <tr> <td>SSID:</td> <td><input type="text" id="ssid"></td> <td><img src="info.png" title="Your Wifi network name"/></td> </tr> <tr> <td>Password:</td> <td><input type="password" id="password"></td> <td><img src="info.png" title="Your Wifi network password"/></td> </tr> <tr> <td>Hostname:</td> <td><input type="text" id="hostname"></td> <td><img src="info.png" title="My hostname on your network"/></td> </tr> <tr> <td>Presets:</td> <td> <table id="presets"> <tr> <td><input type="number" step="0.1" class="preset"></td> </tr> </table> </td> <td/> </tr> <tr> <td>Debugging:</td> <td><input type="checkbox" id="debug"></td> <td><img src="info.png" title="Debug output on Serial port"/></td> </tr> <tr> <td colspan="2" align="center"> <button type="submit" onclick="save_config()">Update</button> </td> </tr> </table> </fieldset> </form> <form action="/update" enctype="multipart/form-data" method="post"> <fieldset> <legend>Firmware Upgrade</legend> <table> <tr> <td>Image File:</td> <td><input name="image" type="file" accept=".ino.bin"/></td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="Upgrade"/> </td> </tr> </table> </fieldset> </form> </body> </html>
Report a bug