diff --git a/src/media/fetch.go b/src/media/fetch.go index 9a6b101..2825d63 100644 --- a/src/media/fetch.go +++ b/src/media/fetch.go @@ -45,7 +45,10 @@ var downloadDir = getDownloadDir() var idCharSet = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString func Index(w http.ResponseWriter, _ *http.Request) { - if err := fetchIndexTmpl.Execute(w, nil); err != nil { + data := map[string]string{ + "ytDlpVersion": GetInstalledVersion(), + } + if err := fetchIndexTmpl.Execute(w, data); err != nil { log.Error().Msgf("Error rendering template: %v", err) http.Error(w, "Internal error", http.StatusInternalServerError) } diff --git a/src/media/updater.go b/src/media/updater.go index f4e18ce..c82cf82 100644 --- a/src/media/updater.go +++ b/src/media/updater.go @@ -65,8 +65,12 @@ func GetInstalledVersion() string { cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { - return "" + log.Error().Err(err).Msgf("Error getting installed version") } - return strings.TrimSpace(string(s.Bytes())) + version := strings.TrimSpace(string(s.Bytes())) + if version != "" { + return version + } + return "unknown" } diff --git a/templates/media/index.html b/templates/media/index.html index 4f8e586..85d203d 100644 --- a/templates/media/index.html +++ b/templates/media/index.html @@ -29,6 +29,7 @@

media roller