From f46f762b26aaaab27c7c19722e1872bd74e78d89 Mon Sep 17 00:00:00 2001 From: Malte Bublitz Date: Sun, 2 Jun 2024 22:57:53 +0200 Subject: [PATCH] whoami: Verbesserte Initialisierung --- js/whoami.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/js/whoami.js b/js/whoami.js index 10b3920..7ade2b6 100644 --- a/js/whoami.js +++ b/js/whoami.js @@ -32,16 +32,22 @@ var whoami = { } if (!this.whoami_host) { console.info("Asking for hostname"); - this.whoami_host = prompt("Hostname (FQDN)", ""); + // 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(); }, -- 2.30.2