Show which version of yt-dlp is installed
This commit is contained in:
parent
03d58bfd1d
commit
ff94a96b92
3 changed files with 11 additions and 3 deletions
|
|
@ -45,7 +45,10 @@ var downloadDir = getDownloadDir()
|
||||||
var idCharSet = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
|
var idCharSet = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
|
||||||
|
|
||||||
func Index(w http.ResponseWriter, _ *http.Request) {
|
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)
|
log.Error().Msgf("Error rendering template: %v", err)
|
||||||
http.Error(w, "Internal error", http.StatusInternalServerError)
|
http.Error(w, "Internal error", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,12 @@ func GetInstalledVersion() string {
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<div>
|
<div>
|
||||||
|
Running <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> version {{ $.ytDlpVersion }}<br>
|
||||||
<p class="text-muted">Source at <a class="text-light" href="https://github.com/rroller/media-roller">https://github.com/rroller/media-roller</a>
|
<p class="text-muted">Source at <a class="text-light" href="https://github.com/rroller/media-roller">https://github.com/rroller/media-roller</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue