whoami: Verbesserte Initialisierung
authorMalte Bublitz <malte@rolltreppe3.de>
Sun, 2 Jun 2024 20:57:53 +0000 (22:57 +0200)
committerMalte Bublitz <malte@rolltreppe3.de>
Sun, 2 Jun 2024 20:57:53 +0000 (22:57 +0200)
js/whoami.js

index 10b3920807f22755c045332572a5e7353fac3c3a..7ade2b62ff3368bfaac6a8caedf45a7f93e05d96 100644 (file)
@@ -32,16 +32,22 @@ var whoami = {
         }
         if (!this.whoami_host) {
             console.info("Asking for hostname");
-            this.whoami_host = prompt("Hostname (FQDN)", "<?=$hostname?>");
+                       // Default value
+                       this.whoami_host = (new URLSearchParams(location.search.substring(1))).get("hostname");
+                       if (this.whoami_host === null) this.whoami_host = "pc.local";
+                       // Ask for the hostname
+            this.whoami_host = prompt("Hostname (FQDN)", this.whoami_host);
                        this.whoami_host_full = this.whoami_host;
             if (this.whoami_host === null)
-                this.whoami_host = "pc";
+                this.whoami_host = "pc.local";
         }
         if (!this.whoami_format) {
-            console.info("Asking for format");
-            this.whoami_format = prompt("Format (unix|windows)", "unix");
-            if (this.whoami_format === null)
-                this.whoami_format = "windows";
+            //console.info("Asking for format");
+            //this.whoami_format = prompt("Format (unix|windows)", "unix");
+            //if (this.whoami_format === null)
+            //    this.whoami_format = "windows";
+                       console.debug("Not asking for format anymore, using default value \"unix\".");
+                       this.whoami_format = "unix";
         }
         
         /*var urlParams = new URLSearchParams(window.location.search);
@@ -70,11 +76,11 @@ var whoami = {
             if (localStorage.getItem("whoami_host") !== null) {
                 this.whoami_host = localStorage.getItem("whoami_host");
             } else {
-                this.whoami_host = "pc";
+                this.whoami_host = "pc.local";
             }
         }
         if (this.whoami_format === null)
-            this.whoami_format = "windows";
+            this.whoami_format = "unix";
                
                this.update();
     },