123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="max80.css" />
- <title class="config">MAX80: Configuration</title>
- <script src="max80.js"></script>
- </head>
- <body>
- <script>inc("head.html")</script>
- <h1 class="config">Configuration</h1>
- <form id="setconfig" action="sys/setconfig" method="post" onsubmit="uploadform()">
- <fieldset class="network">
- <legend>Network</legend>
- <label class="wifi-ssid">
- <span>Network name (SSID):</span>
- <input type="text" name="wifi.ssid" />
- </label>
- <label class="wifi-psk">
- <span>Network password (PSK):</span>
- <input class="mono" type="password" name="wifi.psk" />
- <button type="button" class="show" onclick="showpwd()"><span class="show">show</span><span class="hide">hide</span></button>
- </label>
- </fieldset>
- <fieldset class="datetime">
- <legend>Date and Time</legend>
- <label class="tz">
- <span>Time zone:</span>
- <select name="tzname" id="tzname" onchange="tzn()">
- </select>
- <input type="text" name="TZ" oninput="tzt()" />
- </label>
- <label class="sntp-enabled">
- <span>Synchronize time from network:</span>
- <input type="checkbox" name="sntp.enabled" />
- </label>
- <label class="sntp-server">
- <span>NTP server:</span>
- <input type="text" name="sntp.server" />
- </label>
- <label class="ip4-dhcp-sntp">
- <span>Use DHCP-provided NTP server:</span>
- <input type="checkbox" name="ip4.dhcp.nosntp" value="0" />
- </label>
- </fieldset>
- <button class="submit" type="submit" disabled>Update configuration</button>
- <br />
- <output></output>
- </form>
- <script>
- function tzn() {
- const tz = event.target.selectedOptions[0].dataset.tz;
- if (tz) sib(event.target,'input').value = tz;
- }
- function tzt() { sib(event.target,'select').value = ''; }
- fetchconfig('tz.txt')
- .then(map => {
- function cln(z) {
- return ('tz/'+z).replaceAll('/','_ ')
- .replaceAll(/[^\w ]+/g,'-');
- }
- var elem = getelem('tzname');
- var grp = elem;
- map.set('',''); map.set('UTC','UTC0');
- var zones = Array.from(map.keys());
- zones = zones.filter(v => v && v != 'UTC').sort();
- zones.unshift('','UTC');
- for (const z of zones) {
- const zz = z.match(/^(?:(\S+?)\/)?(\S*)$/,z);
- if (!zz) { continue; }
- if (zz[1] && zz[1] != grp.label) {
- grp = document.createElement('OPTGROUP');
- grp.label = zz[1];
- grp.className = cln(zz[1]);
- elem.append(grp);
- } else if (!zz[1]) {
- grp = elem;
- }
- const pz = zz[2].replaceAll('_',' ').replaceAll('/',': ');
- var opt = new Option(pz, z);
- opt.className = cln(z);
- opt.dataset.tz = map.get(z);
- grp.append(opt);
- }
- translate(elem);
- })
- .finally(() => {loadform('setconfig','sys/getconfig');} );
- </script>
- </body>
- </html>
|