diff --git a/internal/httpservers/webuiServer.go b/internal/httpservers/webuiServer.go index f38b2d28..9e553876 100644 --- a/internal/httpservers/webuiServer.go +++ b/internal/httpservers/webuiServer.go @@ -29,6 +29,8 @@ type webUISettings struct { PageTitle string SectionNavigationStyle string DefaultIconForBack string + SshFoundKey string + SshFoundConfig string } func findWebuiDir() string { @@ -111,8 +113,11 @@ func generateWebUISettings(w http.ResponseWriter, r *http.Request) { PageTitle: cfg.PageTitle, SectionNavigationStyle: cfg.SectionNavigationStyle, DefaultIconForBack: cfg.DefaultIconForBack, + SshFoundKey: installationinfo.Runtime.SshFoundKey, + SshFoundConfig: installationinfo.Runtime.SshFoundConfig, }) + w.Header().Add("Content-Type", "application/json") _, err := w.Write([]byte(jsonRet)) if err != nil { diff --git a/internal/installationinfo/runtimeinfo.go b/internal/installationinfo/runtimeinfo.go index 9b7a021b..ea964737 100644 --- a/internal/installationinfo/runtimeinfo.go +++ b/internal/installationinfo/runtimeinfo.go @@ -18,7 +18,8 @@ type runtimeInfo struct { LastBrowserUserAgent string User string Uid string - FoundSshKey string + SshFoundKey string + SshFoundConfig string AvailableVersion string } @@ -29,20 +30,26 @@ var Runtime = &runtimeInfo{ OSReleasePrettyName: getOsReleasePrettyName(), User: os.Getenv("USER"), Uid: os.Getenv("UID"), -} - -func refreshRuntimeInfo() { - Runtime.FoundSshKey = searchForSshKey() + SshFoundKey: searchForSshKey(), + SshFoundConfig: searchForSshConfig(), } func searchForSshKey() string { - path, _ := filepath.Abs(path.Join(os.Getenv("HOME"), ".ssh/id_rsa")) + return searchForHomeFile(".ssh/id_rsa") +} + +func searchForSshConfig() string { + return searchForHomeFile(".ssh/config") +} + +func searchForHomeFile(file string) string { + path, _ := filepath.Abs(path.Join(os.Getenv("HOME"), file)) if _, err := os.Stat(path); err == nil { return path } - return "none-found at " + path + return "not found at " + path } func isInContainer() bool { diff --git a/internal/installationinfo/sosreport.go b/internal/installationinfo/sosreport.go index b0ce7560..792ce96b 100644 --- a/internal/installationinfo/sosreport.go +++ b/internal/installationinfo/sosreport.go @@ -43,8 +43,6 @@ func configToSosreport(cfg *config.Config) *sosReportConfig { } func GetSosReport() string { - refreshRuntimeInfo() - ret := "" ret += "### SOSREPORT START (copy all text to SOSREPORT END)\n" diff --git a/webui.dev/index.html b/webui.dev/index.html index 1a4e317b..13b22d0f 100644 --- a/webui.dev/index.html +++ b/webui.dev/index.html @@ -33,6 +33,9 @@