Procházet zdrojové kódy

Fix malformed markup and script in legacy WLAN configuration page

SybexXx před 12 hodinami
rodič
revize
5a7cdbf322
1 změnil soubory, kde provedl 15 přidání a 10 odebrání
  1. 15 10
      sd-card/html/wlan_config.html

+ 15 - 10
sd-card/html/wlan_config.html

@@ -1,9 +1,12 @@
+<!DOCTYPE html>
 <html lang="en" xml:lang="en"> 
-    <head> 
-        <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
+    <head>
+    <meta charset="UTF-8">
+    <title>WLAN Configuration</title>
+<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
         <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>  
         <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
-        <script type="text/javascript" src="/common.js?v=$COMMIT_HASH"> 
+        <script type="text/javascript" src="/common.js?v=$COMMIT_HASH"></script> 
     </head>
 <body>
     <table>
@@ -19,26 +22,28 @@
 <button class="button" type="button" onclick="wr();">Write wlan.ini</button>
 <input id="newfile" type="file">
 <button class="button" style="width:300px" id="doUpdate" type="button" onclick="upload()">Upload Files</button>
+<p id="status"></p>
+<p id="progress"></p>
 
 
-<script language="JavaScript">function wr(){
+<script type="text/javascript">
+function wr(){
         api = "/config?"+"ssid"+document.getElementById("ssid").value+"&pwd="+document.getElementById("password").value;+"&hn="+document.getElementById("hostname").value;+"&ip="+document.getElementById("ip").value;+"&gw="+document.getElementById("gateway").value;+"&nm="+document.getElementById("netmask").value;+"&dns="+document.getElementById("dns").value;+"&rssi="+document.getElementById("threshold").value;
         fetch(api);}
 
 
 //    var xhttp = new XMLHttpRequest();
 //    xhttp.onreadystatechange = function() {if (xhttp.readyState == 4) {if (xhttp.status == 200) {document.reload();}}};
-if (!file.name.includes("remote-setup")){
-    if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure you have downloaded the correct file?"))
-        return;
-}
-
     function upload() {
         var xhttp = new XMLHttpRequest();
         xhttp.onreadystatechange = function() {
         if (xhttp.readyState == 4) {stopProgressTimer();if (xhttp.status == 200) {extract();} }};
         var filePath = document.getElementById("newfile").value.split(/[\\\/]/).pop();
         var file = document.getElementById("newfile").files[0];
+        if (!file) {
+            firework.launch("Please select a remote-setup ZIP file first.", "warning", 5000);
+            return;
+        }
         if (!file.name.includes("remote-setup"))
         {
             if (!confirm("The zip file name should contain \"...remote-setup...\". Are you sure you have downloaded the correct file?"))
@@ -85,7 +90,7 @@ if (!file.name.includes("remote-setup")){
     
         var nameneu = document.getElementById("newfile").value;
         filePath = nameneu.split(/[\\\/]/).pop();
-        var _toDo = domainname + "/ota?task=update&file=" + filePath;
+        var _toDo = getDomainname() + "/ota?task=update&file=" + encodeURIComponent(filePath);
         xhttp.open("GET", _toDo, true);
         xhttp.send();
     }