Forráskód Böngészése

Fixed webapp reload on non admin account bug

Toby Chui 3 éve
szülő
commit
e712e0f183
3 módosított fájl, 14 hozzáadás és 6 törlés
  1. 1 1
      main.flags.go
  2. 1 2
      mod/network/netstat/netstat.go
  3. 12 3
      web/SystemAO/modules/moduleList.html

+ 1 - 1
main.flags.go

@@ -28,7 +28,7 @@ var subserviceBasePort = 12810            //Next subservice port
 
 // =========== SYSTEM BUILD INFORMATION ==============
 var build_version = "development"                      //System build flag, this can be either {development / production / stable}
-var internal_version = "0.1.121"                       //Internal build version, [fork_id].[major_release_no].[minor_release_no]
+var internal_version = "0.1.122"                       //Internal build version, [fork_id].[major_release_no].[minor_release_no]
 var deviceUUID string                                  //The device uuid of this host
 var deviceVendor = "IMUSLAB.INC"                       //Vendor of the system
 var deviceVendorURL = "http://imuslab.com"             //Vendor contact information

+ 1 - 2
mod/network/netstat/netstat.go

@@ -135,11 +135,10 @@ func GetNetworkInterfaceStats() (int64, int64, error) {
 						return 0, 0, errTX
 					}
 
-					return int64(rxSum) * 8, int64(txSum) * 8, nil //return results
+					return int64(rxSum) * 8, int64(txSum) * 8, nil
 				}
 			}
 		}
-		outStrs = ""
 
 		return 0, 0, nil //no ethernet adapters with en*/<Link#*>
 	}

+ 12 - 3
web/SystemAO/modules/moduleList.html

@@ -30,7 +30,7 @@
               </table>
               <div class="ui divider"></div>
               <p>If you have installed WebApps manually, you can click the "Reload WebApps" button to load it without restarting ArozOS.</p>
-              <button class="ui basic small blue button" onclick="reloadWebapps();">
+              <button id="reloadWebappButton" class="ui basic small blue button" onclick="reloadWebapps();">
                 <i class="refresh icon"></i> Reload WebApps
               </button>
               <br><br>
@@ -39,9 +39,18 @@
             initModuleList();
 
             function reloadWebapps(){
+                let moduleListBackup = $("#moduleList").html();
                 $("#moduleList").html(`<tr><td colspan="6"><i class="ui loading spinner icon"></i> Reloading...</tr></td>`);
-                $.get("../../system/modules/reload", function(data){
-                    initModuleList();
+                $.ajax({
+                   url: "../../system/modules/reload", 
+                   success: function(data){
+                        initModuleList();
+                   },
+                   error: function(){
+                       //Reload failed (Permission denied?)
+                       $("#moduleList").html(moduleListBackup);
+                       $("#reloadWebappButton").addClass("disabled").html("<i class='ui remove icon'></i> No Permission");
+                   }    
                 });
             }