Explorar o código

Merge remote-tracking branch 'origin/WiFi-Manager' into Over_The_Air_Update

Sebastien %!s(int64=5) %!d(string=hai) anos
pai
achega
de76b8372e

+ 3 - 2
components/wifi-manager/CMakeLists.txt

@@ -2,5 +2,6 @@ idf_component_register(SRCS "dns_server.c" "http_server.c" "json.c" "wifi_manage
                        INCLUDE_DIRS .
                        REQUIRES esp_common 
                        PRIV_REQUIRES newlib freertos  spi_flash nvs_flash mdns pthread wpa_supplicant cmd_system
-                       EMBED_FILES style.css jquery.gz code.js index.html
-)
+                       EMBED_FILES style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz
+
+)

BIN=BIN
components/wifi-manager/bootstrap.min.css.gz


BIN=BIN
components/wifi-manager/bootstrap.min.js.gz


+ 120 - 83
components/wifi-manager/code.js

@@ -11,7 +11,8 @@ if (!String.prototype.format) {
   };
 }
 
-var recovery = false;
+var releaseURL = 'https://api.github.com/repos/sle118/squeezelite-esp32/releases';
+var recovery = true;
 var enableTimers = true;
 var commandHeader = 'squeezelite -b 500:2000 -d all=info ';
 
@@ -24,6 +25,7 @@ var StatusIntervalActive = false;
 var ConfigIntervalActive = false;
 var RefreshAPIIntervalActive = false;
 
+var output = '';
 //TODO check
 var to = 0, set_int = 0;
 
@@ -65,7 +67,7 @@ function RepeatCheckConfigInterval(){
 
 function RepeatRefreshAPInterval(){
 	if(RefreshAPIIntervalActive)
-		startRefreshAPInterval()
+		startRefreshAPInterval();
 }
 
 $(document).ready(function(){
@@ -175,18 +177,110 @@ $(document).ready(function(){
 		$( "#wifi" ).slideDown( "fast", function() {})
 	});
 	
-	$("#update-command").click(function() {
-		updateAutoexec();
-	});	
+	$("#autoexec-cb").on("click", function() {
+        autoexec = (this.checked)?1:0;
+        $.ajax({
+            url: '/config.json',
+            dataType: 'json',
+            method: 'POST',
+            cache: false,
+            headers: { "X-Custom-autoexec": autoexec },
+            data: { 'timestamp': Date.now() }
+        });
+        console.log('sent config JSON with headers:', autoexec);
+    });
+
+	$("#save-autoexec1").on("click", function() {
+        autoexec1 = $("#autoexec1").val();
+        
+        $.ajax({
+            url: '/config.json',
+            dataType: 'json',
+            method: 'POST',
+            cache: false,
+            headers: { "X-Custom-autoexec1": autoexec1 },
+            data: { 'timestamp': Date.now() }
+        });
+        console.log('sent config JSON with headers:', autoexec1);
+    });
 
-	$("#generate-command").click(function() {
-		generateCommand();
+	$("#recovery").on("click", function() {
+        $.ajax({
+            url: '/recovery.json',
+            dataType: 'json',
+            method: 'POST',
+            cache: false,
+            data: { 'timestamp': Date.now()}
+        });
+    });
+
+	$("#reboot").on("click", function() {
+        $.ajax({
+            url: '/reboot.json',
+            dataType: 'json',
+            method: 'POST',
+            cache: false,
+            data: { 'timestamp': Date.now()}
+        });
+    });
+
+	$("#generate-command").on("click", function() {
+        var commandLine = commandHeader + '-n ' + $("#player").val();
+
+        if (output == 'bt') {
+            commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -Z 192000';
+        } else if (output == 'spdif') {
+            commandLine += ' -o SPDIF -R -Z 192000';
+        } else {
+            commandLine += ' -o I2S';
+        }
+        if ($("#optional").val() != '') {
+            commandLine += ' ' + $("#optional").val();
+        }
+        $("#autoexec1").val(commandLine);
 	});	
 
-    $('[name=audio]').click(function(){
-        selectOutput(this);
+    $('[name=audio]').on("click", function(){
+        if (this.id == 'bt') {
+            $("#btsinkdiv").show(200);
+            output = 'bt';
+        } else if (this.id == 'spdif') {
+            $("#btsinkdiv").hide(200);
+            output = 'spdif';
+        } else {
+            $("#btsinkdiv").hide(200);
+            output = 'i2s';
+        }
    	});
 
+    $('#fwcheck').on("click", function(){
+        $("#releaseTable").html("");
+        $.getJSON(releaseURL, function(data) {
+            data.forEach(function(release) {
+                var url = '';
+                release.assets.forEach(function(asset) {
+                    if (asset.name.match(/\.bin$/)) {
+                        url = asset.browser_download_url;
+                    }
+                });
+                var [ver, idf, cfg, branch] = release.name.split('-');
+                $("#releaseTable").append(
+                    "<tr>"+
+                      "<td>"+ver+"</td>"+
+                      "<td>"+idf+"</td>"+
+                      "<td>"+cfg+"</td>"+
+                      "<td>"+branch+"</td>"+
+                      "<td><input id='generate-command' type='button' class='btn btn-success' value='Select' data-url='"+url+"' onclick='setURL(this);' /></td>"+
+                    "</tr>"
+                );
+            });
+        })
+        .fail(function() {
+            alert("failed to fetch release history!");
+        });
+    });
+
+
 	//first time the page loads: attempt to get the connection status and start the wifi scan
 	refreshAP();
     getConfig();
@@ -196,6 +290,20 @@ $(document).ready(function(){
 	startRefreshAPInterval();
 });
 
+function setURL(button) {
+    var url = button.dataset.url;
+    $.ajax({
+        url: '/config.json',
+        dataType: 'json',
+        method: 'POST',
+        cache: false,
+        headers: { "X-Custom-fwurl": url },
+        data: { 'timestamp': Date.now() }
+    });
+    $('[data-url^="http"]').addClass("btn-success").removeClass("btn-danger");
+    $('[data-url="'+url+'"]').addClass("btn-danger").removeClass("btn-success");
+}
+
 function performConnect(conntype){
 	//stop the status refresh. This prevents a race condition where a status 
 	//request would be refreshed with wrong ip info from a previous connection
@@ -240,8 +348,6 @@ function performConnect(conntype){
 	startRefreshAPInterval();
 }
 
-
-
 function rssiToIcon(rssi){
 	if(rssi >= -60){
 		return 'w0';
@@ -367,16 +473,16 @@ function getConfig() {
             } else {
                 console.log('turn off autoexec');
                 $("#autoexec-cb")[0].checked=false;
-                $("#autoexec-command").hide(200);
             }
         }
 		if (data.hasOwnProperty('recovery')) {
             if (data["recovery"] === 1) {
                 recovery = true;
+                $("#tab-wifi").removeClass("active show");
+                $("#tab-system").addClass("active show");
+                $("#navbar").hide();
                 $("#recoverydiv").hide();
                 $("#otadiv").show();
-                $("#command_line").hide();
-                $("#wifi").hide();
             } else {
                 recovery = false;
                 $("#recoverydiv").show();
@@ -399,77 +505,8 @@ function getConfig() {
 	});
 }
 
-function updateAutoexec(){
-	autoexec = ($("#autoexec-cb")[0].checked)?1:0;
-	autoexec1 = $("#autoexec1").val();
-	
-	$.ajax({
-		url: '/config.json',
-		dataType: 'json',
-		method: 'POST',
-		cache: false,
-		headers: { "X-Custom-autoexec": autoexec, "X-Custom-autoexec1": autoexec1 },
-		data: { 'timestamp': Date.now() }
-	});
-    console.log('sent config JSON with headers:', autoexec, autoexec1);
-}
-
-var output = '';
-function selectOutput(el) {
-    if ($(el).attr('id') == 'bt') {
-        $("#btsinkdiv").show(200);
-        output = 'bt';
-    } else if ($(el).attr('id') == 'spdif') {
-        $("#btsinkdiv").hide(200);
-        output = 'spdif';
-    } else {
-        $("#btsinkdiv").hide(200);
-        output = 'i2s';
-    }
-}
 
-function generateCommand() {
-    var commandLine = commandHeader + '-n ' + $("#player").val();
-
-    if (output == 'bt') {
-        commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -Z 192000';
-    } else if (output == 'spdif') {
-        commandLine += ' -o SPDIF -R -Z 192000';
-    } else {
-        commandLine += ' -o I2S';
-    }
-    if ($("#optional").val() != '') {
-        commandLine += ' ' + $("#optional").val();
-    }
-    $("#autoexec1").val(commandLine);
-}
 
-function handleClick(item) {
-    console.log(item);
-    if (item.id == 'autoexec-cb') {
-        if (item.checked) {
-            $("#autoexec-command").show(200);
-        } else {
-            $("#autoexec-command").hide(200);
-        }
-    } else if (item.id == 'recovery') {
-        $.ajax({
-            url: '/recovery.json',
-            dataType: 'json',
-            method: 'POST',
-            cache: false,
-            data: { 'timestamp': Date.now()}
-        });
-    } else if (item.id == 'reboot') {
-        $.ajax({
-            url: '/reboot.json',
-            dataType: 'json',
-            method: 'POST',
-            cache: false,
-            data: { 'timestamp': Date.now()}
-        });
-    }
-}
 
 //TODO daduke check
 function file_change() {

+ 1 - 1
components/wifi-manager/component.mk

@@ -6,6 +6,6 @@
 # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
 # please read the SDK documents if you need to do this.
 #
-COMPONENT_EMBED_FILES := style.css jquery.gz code.js index.html
+COMPONENT_EMBED_FILES := style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz
 CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
 COMPONENT_ADD_INCLUDEDIRS := .

+ 29 - 7
components/wifi-manager/http_server.c

@@ -52,8 +52,14 @@ static TaskHandle_t task_http_server = NULL;
  */
 extern const uint8_t style_css_start[] asm("_binary_style_css_start");
 extern const uint8_t style_css_end[]   asm("_binary_style_css_end");
-extern const uint8_t jquery_gz_start[] asm("_binary_jquery_gz_start");
-extern const uint8_t jquery_gz_end[] asm("_binary_jquery_gz_end");
+extern const uint8_t jquery_gz_start[] asm("_binary_jquery_min_js_gz_start");
+extern const uint8_t jquery_gz_end[] asm("_binary_jquery_min_js_gz_end");
+extern const uint8_t popper_gz_start[] asm("_binary_popper_min_js_gz_start");
+extern const uint8_t popper_gz_end[] asm("_binary_popper_min_js_gz_end");
+extern const uint8_t bootstrap_js_gz_start[] asm("_binary_bootstrap_min_js_gz_start");
+extern const uint8_t bootstrap_js_gz_end[] asm("_binary_bootstrap_min_js_gz_end");
+extern const uint8_t bootstrap_css_gz_start[] asm("_binary_bootstrap_min_css_gz_start");
+extern const uint8_t bootstrap_css_gz_end[] asm("_binary_bootstrap_min_css_gz_end");
 extern const uint8_t code_js_start[] asm("_binary_code_js_start");
 extern const uint8_t code_js_end[] asm("_binary_code_js_end");
 extern const uint8_t index_html_start[] asm("_binary_index_html_start");
@@ -64,7 +70,10 @@ extern const uint8_t index_html_end[] asm("_binary_index_html_end");
 const static char http_html_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/html\n\n";
 const static char http_css_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/css\nCache-Control: public, max-age=31536000\n\n";
 const static char http_js_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\n\n";
-const static char http_jquery_gz_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\nAccept-Ranges: bytes\nContent-Length: 29995\nContent-Encoding: gzip\n\n";
+const static char http_jquery_gz_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\nAccept-Ranges: bytes\nContent-Length: 30604\nContent-Encoding: gzip\n\n";
+const static char http_popper_gz_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\nAccept-Ranges: bytes\nContent-Length: 7487\nContent-Encoding: gzip\n\n";
+const static char http_bootstrap_js_gz_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/javascript\nAccept-Ranges: bytes\nContent-Length: 15412\nContent-Encoding: gzip\n\n";
+const static char http_bootstrap_css_gz_hdr[] = "HTTP/1.1 200 OK\nContent-type: text/css\nAccept-Ranges: bytes\nContent-Length: 25925\nContent-Encoding: gzip\n\n";
 const static char http_400_hdr[] = "HTTP/1.1 400 Bad Request\nContent-Length: 0\n\n";
 const static char http_404_hdr[] = "HTTP/1.1 404 Not Found\nContent-Length: 0\n\n";
 const static char http_503_hdr[] = "HTTP/1.1 503 Service Unavailable\nContent-Length: 0\n\n";
@@ -173,13 +182,25 @@ void http_server_netconn_serve(struct netconn *conn) {
 					netconn_write(conn, http_js_hdr, sizeof(http_js_hdr) - 1, NETCONN_NOCOPY);
 					netconn_write(conn, code_js_start, code_js_end - code_js_start, NETCONN_NOCOPY);
 				}
+				else if(strstr(line, "GET /style.css ")) {
+					netconn_write(conn, http_css_hdr, sizeof(http_css_hdr) - 1, NETCONN_NOCOPY);
+					netconn_write(conn, style_css_start, style_css_end - style_css_start, NETCONN_NOCOPY);
+				}
 				else if(strstr(line, "GET /jquery.js ")) {
 					netconn_write(conn, http_jquery_gz_hdr, sizeof(http_jquery_gz_hdr) - 1, NETCONN_NOCOPY);
 					netconn_write(conn, jquery_gz_start, jquery_gz_end - jquery_gz_start, NETCONN_NOCOPY);
 				}
-				else if(strstr(line, "GET /style.css ")) {
-					netconn_write(conn, http_css_hdr, sizeof(http_css_hdr) - 1, NETCONN_NOCOPY);
-					netconn_write(conn, style_css_start, style_css_end - style_css_start, NETCONN_NOCOPY);
+				else if(strstr(line, "GET /popper.js ")) {
+					netconn_write(conn, http_popper_gz_hdr, sizeof(http_popper_gz_hdr) - 1, NETCONN_NOCOPY);
+					netconn_write(conn, popper_gz_start, popper_gz_end - popper_gz_start, NETCONN_NOCOPY);
+				}
+				else if(strstr(line, "GET /bootstrap.js ")) {
+					netconn_write(conn, http_bootstrap_js_gz_hdr, sizeof(http_bootstrap_js_gz_hdr) - 1, NETCONN_NOCOPY);
+					netconn_write(conn, bootstrap_js_gz_start, bootstrap_js_gz_end - bootstrap_js_gz_start, NETCONN_NOCOPY);
+				}
+				else if(strstr(line, "GET /bootstrap.css ")) {
+					netconn_write(conn, http_bootstrap_css_gz_hdr, sizeof(http_bootstrap_css_gz_hdr) - 1, NETCONN_NOCOPY);
+					netconn_write(conn, bootstrap_css_gz_start, bootstrap_css_gz_end - bootstrap_css_gz_start, NETCONN_NOCOPY);
 				}
 
                 //dynamic stuff
@@ -278,7 +299,7 @@ void http_server_netconn_serve(struct netconn *conn) {
 								ESP_LOGE(TAG,"Unable to process autoexec%u. Name length overflow.",i);
 								break;
 							}
-							if(snprintf(autoexec_key,sizeof(autoexec_key)-1,"autoexec%u",i++)<0)
+							if(snprintf(autoexec_key,sizeof(autoexec_key)-1,"autoexec%u",i)<0)
 							{
 								ESP_LOGE(TAG,"Unable to process autoexec%u. Name length overflow.",i);
 								break;
@@ -295,6 +316,7 @@ void http_server_netconn_serve(struct netconn *conn) {
 								{
 									ESP_LOGE(TAG,"command line length is too long : %s = %s", autoexec_name, autoexec_value);
 								}
+                                i++;
 							}
 							else {
 								ESP_LOGD(TAG,"No matching command found for name %s", autoexec_name);

+ 228 - 183
components/wifi-manager/index.html

@@ -1,212 +1,257 @@
 <!DOCTYPE html>
 <html lang="en">
-	<head>
-		<meta charset="utf-8"/>
-		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
-		<meta name="apple-mobile-web-app-capable" content="yes" />
-		<link rel="stylesheet" href="/style.css">
-		<script src="/jquery.js"></script>
-		<script src="/code.js"></script>
-		<title>esp32-wifi-manager</title>
-	</head>
-
-	<body>
-		<div id="app">
-			<div id="app-wrap">
-                <div id="command_line">
+    <head>
+        <meta charset="utf-8"/>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+        <meta name="apple-mobile-web-app-capable" content="yes" />
+        <link rel="stylesheet" href="/test/bootstrap.min.css"> <!-- TODO delete -->
+        <link rel="stylesheet" href="/bootstrap.css">
+        <link rel="stylesheet" href="/style.css">
+        <script src="/jquery.js"></script>
+        <script src="/bootstrap.js"></script>
+        <script src="/popper.js"></script>
+
+        <!-- TODO delete -->
+        <script src="/test/jquery.min.js"></script>
+        <script src="/test/bootstrap.min.js"></script>
+        <script src="/test/popper.min.js"></script>
+
+        <script src="/code.js"></script>
+
+
+        <title>esp32-wifi-manager</title>
+    </head>
+
+    <body>
+        <ul id="navbar" class="nav nav-tabs">
+            <li class="nav-item">
+                <a class="nav-link active" data-toggle="tab" href="#tab-wifi">WiFi</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link" data-toggle="tab" href="#tab-startup">Startup</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link" data-toggle="tab" href="#tab-audio">Audio + LMS</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link" data-toggle="tab" href="#tab-gpio">GPIO</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link" data-toggle="tab" href="#tab-system">System</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link" data-toggle="tab" href="#tab-credits">Credits</a>
+            </li>
+        </ul>
+
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active show" id="tab-wifi">
+                <div id="wifi">
+                    <div id="wifi-status">
+                        <h2>Connected to:</h2>
+                        <section id="connected-to">
+                            <div class="ape"><div class="w0"><div class="pw"><span></span></div></div></div>
+                        </section>
+                    </div>
+                    <h2>Manual connect</h2>
+                    <section id="manual_add">
+                        <div class="ape">ADD (HIDDEN) SSID</div>
+                    </section>
+                    <h2>or choose a network...</h2>
+                    <section id="wifi-list">
+                    </section>
+                </div>
+
+                <div id="connect_manual">
                     <header>
-                        <h1>Startup command</h1>
+                        <h1>Enter Details</h1>
                     </header>
-                    <h2>
-                        <div id="autoexec" class="toggle">
-                            <label>Run squeezelite automatically at boot
-                                <input id="autoexec-cb" type="checkbox" checked="checked" onclick='handleClick(this);'/><span class="slider"></span>
-                            </label>
-                        </div>
-                    </h2>
-
-                    <div id="autoexec-command">
-                        <div id="audioout" class="toggle-buttons">
-                            <h2>Audio output</h2>
-                            <input type="radio" id="i2s" name="audio" checked='checked' />
-                            <label for="i2s">I2S</label>
-                            <input type="radio" id="spdif" name="audio" />
-                            <label for="spdif">SPDIF</label>
-                            <input type="radio" id="bt" name="audio" />
-                            <label for="bt">Bluetooth</label>
-                        </div>
-                        <div id="btsinkdiv">
-                            <input id="btsink" type="text" value="BT sink name" />
+                    <h2>Manual Connection</h2>
+                    <section>
+                        <input id="manual_ssid" type="text" placeholder="SSID" value="">
+                        <input id="manual_pwd" type="password" placeholder="Password" value="">
+                    </section>
+                    <div class="buttons">
+                        <input id="manual_join" type="button" class="btn btn-success" value="Join" data-connect="manual" />
+                        <input id="manual_cancel" type="button" class="btn btn-danger" value="Cancel"/>
+                    </div>
+                </div>
+
+                <div id="connect">
+                    <header>
+                        <h1>Enter Password</h1>
+                    </header>
+                    <h2>Password for <span id="ssid-pwd"></span></h2>
+                    <section>
+                        <input id="pwd" type="password" placeholder="Password" value="">
+                    </section>
+                    <div class="buttons">
+                        <input id="join" type="button" class="btn btn-success" value="Join" />
+                        <input id="cancel" type="button" class="btn btn-danger" value="Cancel"/>
+                    </div>
+                </div>
+
+                <div id="connect-wait">
+                    <header>
+                        <h1>Please wait...</h1>
+                    </header>
+                    <h2>Connecting to <span id="ssid-wait"></span></h2>
+                    <section>
+                        <div id="loading">
+                            <div class="spinner"><div class="double-bounce1"></div><div class="double-bounce2"></div></div>
+                            <p class="tctr">You may lose wifi access while the esp32 recalibrates its radio. Please wait until your device automatically reconnects. This can take up to 30s.</p>
                         </div>
-                        <div>
-                            <h2>Player name</h2>
-                            <input id="player" type="text" value="squeezelite" />
+                        <div id="connect-success">
+                            <h3 class="gr">Success!</h3>
                         </div>
-                        <div>
-                            <h2>Optional setting (e.g. for LMS IP address)</h2>
-                            <input id="optional" type="text" value="" placeholder="-s 192.168.0.1" />
+                        <div id="connect-fail">
+                            <h3 class="rd">Connection failed</h3>
+                            <p class="tctr">Please double-check wifi password if any and make sure the access point has good signal.</p>
                         </div>
+                    </section>
+                    <div class="buttons">
+                        <input id="ok-connect" type="button" value="OK" class="btn btn-success" />
+                    </div>
+                </div>
 
+                <div id="connect-details">
+                    <div id="connect-details-wrap">
+                        <header>
+                            <h1></h1>
+                        </header>
+                        <h2></h2>
+                        <section>
+                            <div class="buttons">
+                                <input id="disconnect" type="button" value="Disconnect" class="btn btn-danger"/>
+                            </div>
+                        </section>
+                        <h2>IP Address</h2>
+                        <section>
+                            <div class="ape brdb">IP Address:<div id="ip" class="fr"></div></div>
+                            <div class="ape brdb">Subnet Mask:<div id="netmask" class="fr"></div></div>
+                            <div class="ape">Default Gateway:<div id="gw" class="fr"></div></div>
+                        </section>
                         <div class="buttons">
-                            <input id="generate-command" type="button" value="Generate" />
+                            <input id="ok-details" type="button" value="Back" class="btn btn-success" />
+                        </div>
+                    </div>					
+                    <div id="diag-disconnect" class="diag-box">
+                        <div class="diag-box-win">
+                            <p>Are you sure you would like to disconnect from this wifi?</p>
+                            <div class="buttons">
+                                <input id="no-disconnect" type="button" value="No" class="btn btn-success" />
+                                <input id="yes-disconnect" type="button" value="Yes" class="btn btn-danger" />
+                            </div>
                         </div>
-
-                        <h2>Squeezelite command to run</h2>
-                        <section id="command-list">
-                            <textarea id="autoexec1" maxlength="120">squeezelite -o I2S -b 500:2000 -d all=info -M esp32</textarea>
-                        </section>
                     </div>
+                </div>
+            </div>
 
-                    <div class="buttons">
-                        <input id="update-command" type="button" value="Save" />
+            <div class="tab-pane fade" id="tab-startup">
+                <h1>Run squeezelite automatically at boot</h1>
+
+                <div class="custom-control custom-switch">
+                      <input type="checkbox" class="custom-control-input" id="autoexec-cb" checked="checked">
+                      <label class="custom-control-label" for="autoexec-cb"></label>
+                </div>
+            </div>
+
+            <div class="tab-pane fade" id="tab-audio">
+                <div id="audioout">
+                    <h1>Audio output</h1>
+                    <div class="form-group">
+                        <div class="custom-control custom-radio">
+                            <input type="radio" id="i2s" name="audio" class="custom-control-input" checked='checked' />
+                            <label for="i2s" class="custom-control-label">I2S</label>
+                        </div>
+                        <div class="custom-control custom-radio">
+                            <input type="radio" id="spdif" name="audio" class="custom-control-input" />
+                            <label for="spdif" class="custom-control-label">SPDIF</label>
+                        </div>
+                        <div class="custom-control custom-radio">
+                            <input type="radio" id="bt" name="audio" class="custom-control-input" />
+                            <label for="bt" class="custom-control-label">Bluetooth</label>
+                        </div>
                     </div>
                 </div>
+                <div id="btsinkdiv">
+                    <input id="btsink" type="text" value="BT sink name" />
+                </div>
+                <div>
+                    <h1>Player name</h1>
+                    <input id="player" type="text" value="squeezelite" />
+                </div>
+                <div>
+                    <h1>Optional setting (e.g. for LMS IP address)</h1>
+                    <input id="optional" type="text" value="" placeholder="-s 192.168.0.1" />
+                </div>
+
+                <div class="buttons">
+                    <input id="generate-command" type="button" class="btn btn-success" value="Generate" />
+                </div>
+
+                <h1>Squeezelite command to run</h1>
+                <section id="command-list">
+                    <textarea id="autoexec1" maxlength="120">squeezelite -o I2S -b 500:2000 -d all=info -M esp32</textarea>
+                </section>
+                <div class="buttons">
+                    <input id="save-autoexec1" type="button" class="btn btn-success" value="Save" />
+                </div>
+            </div>
+
+            <div class="tab-pane fade" id="tab-gpio">
+            </div>
+
+            <div class="tab-pane fade" id="tab-system">
                 <div id="recoverydiv">
-                    <header><h1>System management</h1></header>
-                    <h2>Check for firmware upgrade</h2>
+                    <h1>Check for firmware upgrade</h1>
                     <div class="buttons">
-                        <input type="button" id="fwcheck" value="Check" onclick='handleClick(this);' />
-                        <p><span id="currentfw">Currently running: 0.1</span> - <span id="latestfw">latest available version: 0.2</span></p>
+                        <input type="button" id="fwcheck" class="btn btn-info" value="Update" />
                     </div>
-                    <h2>Reboot to recovery system to perform firmware upgrade</h2>
+                    <table class="table table-hover">
+                        <thead>
+                            <tr>
+                                <th scope="col">Firmware version</th>
+                                <th scope="col">IDF version</th>
+                                <th scope="col">HW platform</th>
+                                <th scope="col">Branch</th>
+                                <th scope="col">Flash this FW</th>
+                            </tr>
+                        </thead>
+                        <tbody id="releaseTable">
+                        </tbody>
+                    </table>
+                    <h1>Reboot to recovery system to perform firmware upgrade</h1>
                     <div class="buttons">
-                        <input type="button" id="recovery" value="Recovery" onclick='handleClick(this);' />
+                        <input type="button" id="recovery" class="btn btn-warning" value="Recovery" />
                     </div>
                 </div>
                 <div id="otadiv">
                     <header><h1>Firmware upgrade</h1></header>
                     <form name="multipart" action="otaform" method="post" enctype="multipart/form-data" onsubmit="do_upload(this); return false;">
                         <progress id="progr" value="0" max="100" >Upload Progress</progress>
-                        <input type="file" name="ota" id="ota" size="20" accept=".bin" onchange="file_change();">
-                        <span id="file_info"></span>
-                        <input type="submit" id="update" disabled="" value="Upload">
                     </form>
-                    <h2>Reboot system with new firmware</h2>
+                    <h1>Reboot system with new firmware</h1>
                     <div class="buttons">
-                        <input type="button" id="reboot" value="Reboot" onclick='handleClick(this);' />
+                        <input type="button" id="reboot" class="btn btn-warning" value="Reboot" />
                     </div>
                 </div>
+            </div>
+
+            <div class="tab-pane fade" id="tab-credits">
+                <section>
+                    <p><strong>esp32-wifi-manager</strong>, &copy; 2017-2019, Tony Pottier<br />Licender under the MIT License.</p>
+                    <p>
+                    This app would not be possible without the following libraries:
+                    </p>
+                    <ul>
+                        <li>SpinKit, &copy;  2015, Tobias Ahlin. Licensed under the MIT License.</li>
+                        <li>jQuery, The jQuery Foundation. Licensed under the MIT License.</li>
+                        <li>cJSON, &copy; 2009-2017, Dave Gamble and cJSON contributors. Licensed under the MIT License.</li>
+                    </ul>
+                </section>
+            </div>
 
-				<div id="wifi">
-					<header>
-						<h1>Wi-Fi</h1>
-					</header>
-					<div id="wifi-status">
-						<h2>Connected to:</h2>
-						<section id="connected-to">
-							<div class="ape"><div class="w0"><div class="pw"><span></span></div></div></div>
-						</section>
-					</div>
-					<h2>Manual connect</h2>
-					<section id="manual_add">
-					<div class="ape">ADD (HIDDEN) SSID<div>
-					</section>
-					<h2>or choose a network...</h2>
-					<section id="wifi-list">
-					</section>
-					<div id="pwrdby"><em>Powered by </em><a id="acredits" href="#"><strong>esp32-wifi-manager</strong></a>.</div>
-				</div>
-				<div id="connect_manual">
-					<header>
-						<h1>Enter Details</h1>
-					</header>
-					<h2>Manual Connection</h2>
-					<section>
-						<input id="manual_ssid" type="text" placeholder="SSID" value="">
-						<input id="manual_pwd" type="password" placeholder="Password" value="">
-					</section>
-					<div class="buttons">
-							<input id="manual_join" type="button" value="Join" data-connect="manual" />
-							<input id="manual_cancel" type="button" value="Cancel"/>
-					</div>
-				</div>
-				<div id="connect">
-					<header>
-						<h1>Enter Password</h1>
-					</header>
-					<h2>Password for <span id="ssid-pwd"></span></h2>
-					<section>
-						<input id="pwd" type="password" placeholder="Password" value="">
-					</section>
-					<div class="buttons">
-							<input id="join" type="button" value="Join" />
-							<input id="cancel" type="button" value="Cancel"/>
-					</div>
-				</div>
-				<div id="connect-wait">
-					<header>
-						<h1>Please wait...</h1>
-					</header>
-					<h2>Connecting to <span id="ssid-wait"></span></h2>
-					<section>
-						<div id="loading">
-							<div class="spinner"><div class="double-bounce1"></div><div class="double-bounce2"></div></div>
-							<p class="tctr">You may lose wifi access while the esp32 recalibrates its radio. Please wait until your device automatically reconnects. This can take up to 30s.</p>
-						</div>
-						<div id="connect-success">
-							<h3 class="gr">Success!</h3>
-						</div>
-						<div id="connect-fail">
-							<h3 class="rd">Connection failed</h3>
-							<p class="tctr">Please double-check wifi password if any and make sure the access point has good signal.</p>
-						</div>
-					</section>
-					<div class="buttons">
-						<input id="ok-connect" type="button" value="OK" class="ctr" />
-					</div>
-				</div>
-				<div id="connect-details">
-					<div id="connect-details-wrap">
-						<header>
-							<h1></h1>
-						</header>
-						<h2></h2>
-						<section>
-							<div class="buttons">
-								<input id="disconnect" type="button" value="Disconnect" class="ctr"/>
-							</div>
-						</section>
-						<h2>IP Address</h2>
-						<section>
-							<div class="ape brdb">IP Address:<div id="ip" class="fr"></div></div>
-							<div class="ape brdb">Subnet Mask:<div id="netmask" class="fr"></div></div>
-							<div class="ape">Default Gateway:<div id="gw" class="fr"></div></div>
-						</section>
-						<div class="buttons">
-							<input id="ok-details" type="button" value="OK" class="ctr" />
-						</div>
-					</div>					
-					<div id="diag-disconnect" class="diag-box">
-						<div class="diag-box-win">
-							<p>Are you sure you would like to disconnect from this wifi?</p>
-							<div class="buttons">
-								<input id="no-disconnect" type="button" value="No" />
-								<input id="yes-disconnect" type="button" value="Yes" />
-							</div>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-		<div id="credits">
-			<header>
-				<h1>About this app...</h1>
-			</header>
-			<h2></h2>
-			<section>
-				<p><strong>esp32-wifi-manager</strong>, &copy; 2017-2019, Tony Pottier<br />Licender under the MIT License.</p>
-				<p>
-					This app would not be possible without the following libraries:
-				</p>
-				<ul>
-					<li>SpinKit, &copy;  2015, Tobias Ahlin. Licensed under the MIT License.</li>
-					<li>jQuery, The jQuery Foundation. Licensed under the MIT License.</li>
-					<li>cJSON, &copy; 2009-2017, Dave Gamble and cJSON contributors. Licensed under the MIT License.</li>
-				</ul>
-			</section>
-			<div class="buttons">
-				<input id="ok-credits" type="button" value="OK" class="ctr" />
-			</div>
-		</div>
-	</body>
-<html>
+        </div>
+    </body>
+</html>

BIN=BIN
components/wifi-manager/jquery.gz


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 1
components/wifi-manager/jquery.js


BIN=BIN
components/wifi-manager/jquery.min.js.gz


BIN=BIN
components/wifi-manager/popper.min.js.gz


+ 72 - 142
components/wifi-manager/style.css

@@ -1,8 +1,6 @@
 body {
-    background-color: #eee;
     border: 0;
     margin: 0;
-    font: 1.1em tahoma, arial, sans-serif;
 }
 a {
     color: darkblue;
@@ -12,49 +10,12 @@ a {
 a:hover {
     color: red;
 }
-input {
-    font: 1.1em tahoma, arial, sans-serif;
-}
 input:focus,
 select:focus,
 textarea:focus,
 button:focus {
     outline: none;
 }
-input[type="button"] {
-    padding: 5px;
-    text-align: center;
-    display: block;
-}
-p {
-    padding: 10px;
-}
-#credits {
-    display: none;
-}
-#app {} #app-wrap {} #disconnect {
-    width: 150px;
-}
-.diag-box {
-    position: absolute;
-    top: 0;
-    left: 0;
-    bottom: 0;
-    right: 0;
-    height: 100%;
-    width: 100%;
-    display: none;
-}
-.diag-box-win {
-    position: absolute;
-    left: 10%;
-    width: 80%;
-    text-align: center;
-    border: 2px outset #888;
-    background-color: #fff;
-    border-radius: 10px;
-    top: 20%;
-}
 .blur {
     -webkit-filter: blur(2px);
     -moz-filter: blur(2px);
@@ -65,29 +26,26 @@ p {
 .ape {
     margin-left: 20px;
     padding: 10px 0px 10px 10px;
+    background-color: #444;
 }
 .ape:hover {
     cursor: pointer;
 }
-.brdb {
-    border-bottom: 1px solid #888;
-}
 header {
-    background-color: #fff;
-    border-bottom: 1px solid #888;
-    border-top: 1px solid #888;
+    border-bottom: 1px solid #000;
+    border-top: 1px solid #000;
 }
 section {
-    background-color: #fff;
-    border-bottom: 1px solid #888;
-    border-top: 1px solid #888;
+    border-bottom: 1px solid #000;
+    border-top: 1px solid #000;
 }
 h1 {
-    display: block;
-    text-align: center;
     margin: 0;
-    padding: 15px;
-    font-size: 1.4em
+    margin-top: 20px;
+    padding: 10px;
+    text-transform: uppercase;
+    color: #888;
+    font-size: 1.6em
 }
 h2 {
     margin: 0;
@@ -154,9 +112,6 @@ h3 {
 #no-disconnect {
     display: inline-block;
 }
-.ctr {
-    margin: 0 auto;
-}
 .tctr {
     text-align: center;
 }
@@ -172,6 +127,9 @@ h3 {
 #connect-details {
     display: none;
 }
+#diag-disconnect {
+    display: none;
+}
 .fr {
     float: right;
     margin-right: 20px;
@@ -248,117 +206,91 @@ h3 {
 }
 /* end of SpinKit */
 
-.toggle label {
-	position: relative;
-	display: inline-block;
-	height: 3.5em;
+/* daduke stuff */
+input[type='text'], input[type='password'], textarea {
+  background: #999;
+  border: 0;
+  padding: 4px;
 }
 
-.toggle input {
-	display: none;
-}
 
-.toggle .slider {
-	/* Grundfläche */
-	
-	position: absolute;
-	cursor: pointer;
-	top: 1.5em;
 
-    left: 8px;
-
-	width: 4em;
-	height: 2em;
-	background-color: #c32e04;
-	/* red */
-	
-	transition: all .3s ease-in-out;
-	border-radius: 1em;
+.custom-switch, .custom-radio {
+  padding-left: 2.25rem;
+  margin-left: 12px;
+  padding-bottom: 1rem;
 }
 
-.toggle .slider:before {
-	/* verschiebbarer Button */
-	
-	position: absolute;
-	content: "";
-	height: 1.6em;
-	width: 1.6em;
-	left: 0.2em;
-	bottom: 0.2em;
-	background-color: white;
-	border-radius: 50%;
-	transition: all .3s ease-in-out;
+.custom-checkbox > .custom-control-label {
+  padding-top: 0.5rem;
+  padding-left: 2rem;
+  padding-bottom: 0.1rem;
 }
 
-.toggle input:checked + .slider {
-	background-color: #5a9900;
-	/* green */
+.custom-switch .custom-control-label::before {
+  left: -2.25rem;
+  height: 2rem;
+  width: 3.5rem;
+  pointer-events: all;
+  border-radius: 1rem;
 }
 
-.toggle input:focus + .slider {
-	background-color: pink;
-	box-shadow: 0 0 1px #5a9900;
+.custom-switch .custom-control-label::after {
+  top: calc(0.25rem + 2px);
+  left: calc(-2.25rem + 2px);
+  width: calc(2rem - 4px);
+  height: calc(2rem - 4px);
+  background-color: #adb5bd;
+  border-radius: 2rem;
+  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-transform 0.15s ease-in-out;
+  transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+  transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-transform 0.15s ease-in-out;
+}
+@media (prefers-reduced-motion: reduce) {
+  .custom-switch .custom-control-label::after {
+    transition: none;
+  }
 }
 
-.toggle input:checked + .slider:before {
-	-webkit-transform: translateX(1.9em);
-	/* Android 4 */
-	
-	-ms-transform: translateX(1.9em);
-	/* IE9 */
-	
-	transform: translateX(1.9em);
+.custom-switch .custom-control-input:checked ~ .custom-control-label::after {
+  background-color: #fff;
+  -webkit-transform: translateX(1.5rem); //translateX(0.75rem);
+  transform: translateX(1.5rem); //translateX(0.75rem);
 }
 
-.text .slider:after {
-	/* Text vor dem FlipFlop-Schalter */
-	
-	position: absolute;
-	content: "AUS";
-	color: #c32e04;
-	font-weight: bold;
-	height: 1.6em;
-	left: -2.5em;
-	bottom: 0.2em;
-}
 
-.text input:checked + .slider:after {
-	/* Text hinter dem FlipFlop-Schalter */
-	
-	position: absolute;
-	content: "AN";
-	color: #5a9900;
-	left: 4.5em;
-}
 
-input#autoexec1 {
-    border: none;
-    margin-left: 35px;
-    padding: 10px 0px 10px 10px;
-}
 
-input#ota {
-    margin-top: 5px;
-    margin-bottom: 5px;
+
+
+
+
+textarea#autoexec1 {
+    width: 80%;
 }
 
-#otadiv {
-    margin-bottom: 15px;
+input, textarea {
+    margin-left: 10px;
+    border-radius: 3px;
+    border: 1px solid transparent;
+    border-top: none;
+    border-bottom: 1px solid #DDD;
+    box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
 }
 
-#btsink, #player, #optional {
-    margin-left: 13px;
+.form-group {
+    margin-left: 10px;
 }
 
-#btsinkdiv {
-    display: none;
-    margin-top: 20px;
+#otadiv {
+	display: none;
 }
 
-textarea#autoexec1 {
-    width: 100%;
+#btsinkdiv {
+	display: none;
 }
 
+/* 
 .toggle-buttons input[type="radio"] {
 	visibility: hidden;
     width: 3px;
@@ -376,6 +308,4 @@ textarea#autoexec1 {
 	box-shadow: none;
 }
 
-#otadiv {
-	display: none;
-}
+*/

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio