diff --git a/web/routes.go b/web/routes.go index 2ee1894..6dd7228 100644 --- a/web/routes.go +++ b/web/routes.go @@ -20,6 +20,7 @@ type routes struct { func (r *routes) Register(app *fiber.App) { app.Get("/", r.IndexHandler) + app.Get("/home", r.HomeHandler) app.Get("/download", r.DownloadHandler) app.Head("/download/proxy", r.DownloadProxyHandler) app.Get("/download/proxy", r.DownloadProxyHandler) @@ -35,6 +36,13 @@ func (r *routes) IndexHandler(c *fiber.Ctx) error { }, "views/layouts/main") } +func (r *routes) HomeHandler(c *fiber.Ctx) error { + return c.Render("views/index", fiber.Map{ + "BasePath": viper.GetString("base_path"), + "Flash": flash.Get(c), + }) +} + func (r *routes) DownloadHandler(c *fiber.Ctx) error { urlBytes, err := url.QueryUnescape(c.Query("url")) if err != nil { @@ -60,14 +68,11 @@ func (r *routes) DownloadHandler(c *fiber.Ctx) error { } return c.Render("views/download", fiber.Map{ - "BasePath": viper.GetString("base_path"), - "Url": url, - "Meta": meta, - "Videos": GetVideos(meta), - "Version": version.Version, - "Build": version.Build, - "YtdlpVersion": r.ytdl.Version, - }, "views/layouts/main") + "BasePath": viper.GetString("base_path"), + "Url": url, + "Meta": meta, + "Videos": GetVideos(meta), + }) } func (r *routes) DownloadProxyHandler(c *fiber.Ctx) error { diff --git a/web/views/download.html b/web/views/download.html index a55660c..fc28ef7 100644 --- a/web/views/download.html +++ b/web/views/download.html @@ -2,35 +2,50 @@
{{.Url}}
- + + -{{$root := .}} - -{{range $vidIndex, $video := .Videos}} -{{if not (eq $vidIndex 0)}} +{{$root := .}} {{range $vidIndex, $video := .Videos}} {{if not (eq $vidIndex +0)}}
Download videos from over a thousand websites with the help of
- yt-dlp,
- a fork of youtube-dl with more features and fixes.
+ yt-dlp, a fork of youtube-dl
+ with more features and fixes.
View a complete list of supported websites
- here.
+ here.