basic status page, move config into data dir
This commit is contained in:
17
handlers/footer.go
Normal file
17
handlers/footer.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package handlers
|
||||
|
||||
import "ytdlp-site/config"
|
||||
|
||||
type Footer struct {
|
||||
BuildDate string
|
||||
BuildId string
|
||||
BuildIdShort string
|
||||
}
|
||||
|
||||
func MakeFooter() Footer {
|
||||
return Footer{
|
||||
BuildDate: config.GetBuildDate(),
|
||||
BuildId: config.GetGitSHA(),
|
||||
BuildIdShort: config.GetGitSHA()[0:7],
|
||||
}
|
||||
}
|
28
handlers/status.go
Normal file
28
handlers/status.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"ytdlp-site/ffmpeg"
|
||||
"ytdlp-site/ytdlp"
|
||||
)
|
||||
|
||||
func StatusGet(c echo.Context) error {
|
||||
|
||||
ytdlpStdout, _, err := ytdlp.Run("--version")
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
ffmpegStdout, _, err := ffmpeg.Ffmpeg("-version")
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
|
||||
return c.Render(http.StatusOK, "status.html", map[string]interface{}{
|
||||
"ytdlp": string(ytdlpStdout),
|
||||
"ffmpeg": string(ffmpegStdout),
|
||||
"Footer": MakeFooter(),
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user