Browse Source

Fixed image loading in wifi page

Toby Chui 2 years ago
parent
commit
56573f7022

+ 12 - 1
mod/fileservers/servers/sftpserv/sftpserv.go

@@ -80,7 +80,7 @@ func (m *Manager) closeInstance() {
 	enableUPnP := getUpnPEnabled(m.option.Sysdb)
 
 	if enableUPnP {
-		m.option.Upnp.Connection.Clear(uint16(m.listeningPort))
+		m.option.Upnp.ClosePort(m.listeningPort)
 	}
 }
 
@@ -167,6 +167,17 @@ func (m *Manager) HandleToogleUPnP(w http.ResponseWriter, r *http.Request) {
 	} else if enableUpnp == "false" {
 		//Disable UpnP
 		m.option.Sysdb.Write("sftp", "upnp", false)
+
+		if m.IsEnabled() {
+			//Restart the services
+			m.ServerToggle(false)
+			time.Sleep(300 * time.Microsecond)
+			m.ServerToggle(true)
+		}
+
+		//Remove UPnP forwarded port
+		m.option.Upnp.ClosePort(m.listeningPort)
+
 		common.SendOK(w)
 	} else {
 		common.SendErrorResponse(w, "unknown operation")

+ 1 - 0
web/SystemAO/network/img/wifi-noiface.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="m33.65 29.4-1.75-1.75q1.45-1.6 2.225-3.55.775-1.95.775-4.1 0-2.2-.825-4.175-.825-1.975-2.325-3.575l1.75-1.75q1.9 1.9 2.9 4.35 1 2.45 1 5.15 0 2.65-1 5.05t-2.75 4.35Zm-6.3-6.3-6.45-6.45q.6-.6 1.425-.9.825-.3 1.675-.3 1.9 0 3.225 1.325Q28.55 18.1 28.55 20q0 .85-.3 1.65-.3.8-.9 1.45ZM38.25 34l-1.75-1.75q2.35-2.55 3.675-5.675Q41.5 23.45 41.5 20q0-3.5-1.35-6.675t-3.8-5.675L38.1 5.9q2.85 2.85 4.375 6.475Q44 16 44 20q0 3.95-1.525 7.55-1.525 3.6-4.225 6.45Zm2.4 10.95L25.5 29.8V42h-3V26.8l-9.1-9.1q-.2.55-.25 1.125-.05.575-.05 1.175 0 2.2.8 4.2t2.35 3.55L14.5 29.5q-1.9-1.9-2.9-4.35-1-2.45-1-5.15 0-1.15.175-2.225.175-1.075.575-2.125l-3.1-3.1q-.85 1.75-1.3 3.625Q6.5 18.05 6.5 20q0 3.5 1.325 6.675t3.825 5.675L9.9 34.1q-2.85-2.8-4.375-6.45Q4 24 4 20q0-2.45.6-4.8.6-2.35 1.75-4.55l-3.3-3.3L5.2 5.2l37.6 37.6Z"/></svg>

+ 1 - 0
web/SystemAO/network/img/wifi-off.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M44.85 21.7q-4.4-4.2-9.625-6.7T24 12.5q-1.85 0-3.55.225-1.7.225-2.85.625L13.95 9.7q2.2-.8 4.775-1.25Q21.3 8 24 8q7 0 13.175 2.9Q43.35 13.8 48 18.55Zm-8.45 8.45q-1.65-1.6-3-2.575-1.35-.975-3.45-1.925L24.3 20q4.75.1 8.375 1.95Q36.3 23.8 39.55 27Zm3.85 14.4-19.7-19.7q-2.7.65-4.975 2.1-2.275 1.45-3.975 3.2L8.45 27q1.85-1.85 3.825-3.25T17 21.25l-5.55-5.55Q9.1 16.85 7 18.425 4.9 20 3.15 21.7L0 18.55q1.8-1.85 3.85-3.45t4.2-2.75l-4.6-4.6L5.6 5.6l36.8 36.8Zm-16.25-2-7.4-7.45q1.45-1.45 3.325-2.275Q21.8 32 24 32t4.075.825q1.875.825 3.325 2.275Z"/></svg>

+ 1 - 0
web/SystemAO/network/img/wifi-on.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M11.6 30.15 8.45 27q3.5-3.5 7.325-5.25T24 20q4.4 0 8.225 1.75Q36.05 23.5 39.55 27l-3.15 3.15q-3.05-3.05-6.15-4.35-3.1-1.3-6.25-1.3t-6.25 1.3q-3.1 1.3-6.15 4.35ZM3.15 21.7 0 18.55q4.65-4.75 10.825-7.65Q17 8 24 8q7 0 13.175 2.9Q43.35 13.8 48 18.55l-3.15 3.15q-4.4-4.2-9.625-6.7T24 12.5q-6 0-11.225 2.5T3.15 21.7ZM24 42.55l7.4-7.45q-1.45-1.45-3.325-2.275Q26.2 32 24 32t-4.075.825Q18.05 33.65 16.6 35.1Z"/></svg>

+ 12 - 2
web/SystemAO/network/wifiinfo.html

@@ -39,14 +39,20 @@
         #status.connected{
             color: rgb(68, 177, 132);
         }
+
+        #wifiicon{
+            margin-left: auto;
+            margin-right: auto;
+            display: block;
+        }
     </style>
 </head>
 <body>
     <br><br>
     <div class="ui container gradientbg">
         <div class="ui stackable grid">
-            <div class="six wide column statusIcon" align="center" data-aos="fade-right">
-                <img src="img/wifi.svg">
+            <div class="six wide column statusIcon" data-aos="fade-right"  align="center">
+                <img id="wifiicon" class="ui small image"  src="../network/img/wifi-on.svg">
                 <div id="status">Loading...</div>
             </div>
             <div class="ten wide column">
@@ -88,23 +94,27 @@
                         $("#SSID").text("N/A");
                         $("#Interface").text("loopback");
                         $("#status").text("Access Error");
+                        $("#wifiicon").attr('src', "../network/img/wifi-off.svg");
                         console.log(data.error);
                     }else if (data.ESSID == "" && data.Interface != ""){
                         //Have WiFi interface but not connected to any hostspot
                         $("#SSID").text("N/A");
                         $("#Interface").text(data.Interface);
                         $("#status").text("Standby");
+                        $("#wifiicon").attr('src', "../network/img/wifi-on.svg");
                     }else if (data.Interface == ""){
                         //No WiFi Interface
                         $("#SSID").text("N/A");
                         $("#Interface").text("No WiFi Interface");
                         $("#status").html(`<i class="ui remove icon"></i> Missing WiFi Interface`);
+                        $("#wifiicon").attr('src', "../network/img/wifi-noiface.svg");
                         $("#status").addClass("error");
                     }else{
                         //Connection Established
                         $("#SSID").text(data.ESSID);
                         $("#Interface").text(data.Interface);
                         $("#status").html(`<i class="ui checkmark icon"></i> Connected`);
+                        $("#wifiicon").attr('src', "../network/img/wifi-on.svg");
                         $("#status").addClass("connected");
                     }
                 }