Bläddra i källkod

Added experimental auth images and vendor icon in vendor-res folder

TC pushbot 5 2 år sedan
förälder
incheckning
bc313a21b3
6 ändrade filer med 42 tillägg och 18 borttagningar
  1. 1 1
      main.flags.go
  2. 11 2
      mod/info/hardwareinfo/hardwareinfo.go
  3. 27 12
      system.info.go
  4. BIN
      vendor-res/auth_bg.jpg
  5. 2 2
      web/SystemAO/info/index.html
  6. 1 1
      web/login.system

+ 1 - 1
main.flags.go

@@ -29,7 +29,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.2.011"                       //Internal build version, [fork_id].[major_release_no].[minor_release_no]
+var internal_version = "0.2.012"                       //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

+ 11 - 2
mod/info/hardwareinfo/hardwareinfo.go

@@ -54,8 +54,8 @@ func NewInfoServer(a ArOZInfo) *Server {
 }
 
 /*
-	PrintSystemHardwareDebugMessage print system information on Windows.
-	Which is lagging but helpful for debugging wmic on Windows
+PrintSystemHardwareDebugMessage print system information on Windows.
+Which is lagging but helpful for debugging wmic on Windows
 */
 func PrintSystemHardwareDebugMessage() {
 	log.Println("Windows Version: " + wmicGetinfo("os", "Caption")[0])
@@ -72,6 +72,15 @@ func (s *Server) GetArOZInfo(w http.ResponseWriter, r *http.Request) {
 	jsonData, err := json.Marshal(s.hostInfo)
 	if err != nil {
 		log.Println(err)
+		return
+	}
+
+	loadImage, _ := utils.GetPara(r, "icon")
+	if loadImage != "true" {
+		t := ArOZInfo{}
+		json.Unmarshal(jsonData, &t)
+		t.VendorIcon = ""
+		jsonData, _ = json.Marshal(t)
 	}
 
 	utils.SendJSONResponse(w, string(jsonData))

+ 27 - 12
system.info.go

@@ -3,9 +3,11 @@ package main
 import (
 	"encoding/json"
 	"net/http"
+	"path/filepath"
 	"runtime"
 	"time"
 
+	fs "imuslab.com/arozos/mod/filesystem"
 	info "imuslab.com/arozos/mod/info/hardwareinfo"
 	"imuslab.com/arozos/mod/info/logviewer"
 	usage "imuslab.com/arozos/mod/info/usageinfo"
@@ -59,17 +61,22 @@ func SystemInfoInit() {
 		StartDir: "SystemAO/info/overview.html",
 	})
 
+	//Load the vendor icon
+	vendorIconSrc := filepath.Join(vendorResRoot, "vendor_icon.png")
+	if !fs.FileExists(vendorIconSrc) {
+		vendorIconSrc = "./web/img/public/vendor_icon.png"
+	}
+	imageBase64, _ := utils.LoadImageAsBase64(vendorIconSrc)
 	if *allow_hardware_management {
 		infoServer = info.NewInfoServer(info.ArOZInfo{
 			BuildVersion: build_version + "." + internal_version,
 			DeviceVendor: deviceVendor,
 			DeviceModel:  deviceModel,
-			//TODO: FIX THIS
-			//VendorIcon:   "../../" + iconVendor,
-			SN:       deviceUUID,
-			HostOS:   runtime.GOOS,
-			CPUArch:  runtime.GOARCH,
-			HostName: *host_name,
+			VendorIcon:   imageBase64,
+			SN:           deviceUUID,
+			HostOS:       runtime.GOOS,
+			CPUArch:      runtime.GOARCH,
+			HostName:     *host_name,
 		})
 
 		router.HandleFunc("/system/info/getCPUinfo", info.GetCPUInfo)
@@ -110,12 +117,11 @@ func SystemInfoInit() {
 			BuildVersion: build_version + "." + internal_version,
 			DeviceVendor: deviceVendor,
 			DeviceModel:  deviceModel,
-			//TODO: FIX THIS
-			//VendorIcon:   "../../" + iconVendor,
-			SN:       deviceUUID,
-			HostOS:   "virtualized",
-			CPUArch:  "generic",
-			HostName: *host_name,
+			VendorIcon:   imageBase64,
+			SN:           deviceUUID,
+			HostOS:       "virtualized",
+			CPUArch:      "generic",
+			HostName:     *host_name,
 		})
 	}
 
@@ -125,6 +131,15 @@ func SystemInfoInit() {
 	//ArOZ Info do not need permission router
 	http.HandleFunc("/system/info/getArOZInfo", infoServer.GetArOZInfo)
 
+	//Router to handle login background image loading
+	http.HandleFunc("/system/info/wallpaper", func(w http.ResponseWriter, r *http.Request) {
+		imgsrc := filepath.Join(vendorResRoot, "auth_bg.jpg")
+		if !fs.FileExists(imgsrc) {
+			imgsrc = "./web/img/public/auth_bg.jpg"
+		}
+		http.ServeFile(w, r, imgsrc)
+	})
+
 	go func() {
 		if updates.CheckLauncherPortResponsive() {
 			//Launcher port is responsive. Assume launcher exists

BIN
vendor-res/auth_bg.jpg


+ 2 - 2
web/SystemAO/info/index.html

@@ -108,9 +108,9 @@
     });
 
     function initSystemInfo() {
-        $.getJSON("../../system/info/getArOZInfo", function(data) {
+        $.getJSON("../../system/info/getArOZInfo?icon=true", function(data) {
             $("#modelname").html(data["DeviceModel"]);
-            $("#icon").attr("src", "/SystemAO/info/" + data["VendorIcon"]);
+            $("#icon").attr("src", "data:image/png;base64," + data["VendorIcon"]);
             $("#build").html(data["BuildVersion"]);
             $("#manufacturer").html(data["DeviceVendor"]);
         });

+ 1 - 1
web/login.system

@@ -25,7 +25,7 @@
         min-width:calc(100% - 500px);
         min-height:100%;
         background-color:#faf7eb;
-        background-image:url("img/public/auth_bg.jpg");
+        background-image:url("system/info/wallpaper");
         -webkit-background-size: cover;
         -moz-background-size: cover;
         -o-background-size: cover;