From 3cbc5b410b3a611e62cff9cfc1d3905a37ee9101 Mon Sep 17 00:00:00 2001 From: Evan Fiordeliso Date: Fri, 14 Apr 2023 22:42:44 -0400 Subject: [PATCH] Add sticky footer --- .air.toml | 4 ++-- Taskfile.yml | 10 +++++++-- version/version.go | 4 ++++ web/serve.go | 16 +++++++++++--- web/views/index.html | 7 +++++- web/views/layouts/main.html | 11 ++++++---- web/views/partials/footer.html | 22 +++++++++++++++++++ ytdl/version.go | 39 ++++++++++++++++++++++++++++++++++ 8 files changed, 101 insertions(+), 12 deletions(-) create mode 100644 version/version.go create mode 100644 web/views/partials/footer.html create mode 100644 ytdl/version.go diff --git a/.air.toml b/.air.toml index 0d4e933..095bf00 100644 --- a/.air.toml +++ b/.air.toml @@ -4,8 +4,8 @@ tmp_dir = "tmp" [build] args_bin = ["-l", "0.0.0.0"] -bin = "./tmp/main" -cmd = "go build -o ./tmp/main ." +bin = "./ytdl-web" +cmd = "task build" delay = 1000 exclude_dir = ["assets", "tmp", "vendor", "testdata"] exclude_file = [] diff --git a/Taskfile.yml b/Taskfile.yml index 4ae28f6..33e3086 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,7 +1,13 @@ version: "3" +vars: + VERSION: 1.0.0 + VERSION_PKG: go.fifitido.net/ytdl-web/version + BUILD: + sh: git rev-parse --short HEAD + tasks: deps: go mod download tidy: go mod tidy - build: go build -o ytdl-web . - dev: air \ No newline at end of file + build: go build -ldflags="-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Build={{.BUILD}}" -o ytdl-web . + dev: air diff --git a/version/version.go b/version/version.go new file mode 100644 index 0000000..e40727f --- /dev/null +++ b/version/version.go @@ -0,0 +1,4 @@ +package version + +var Version string +var Build string diff --git a/web/serve.go b/web/serve.go index c9ec29d..c3c5ebc 100644 --- a/web/serve.go +++ b/web/serve.go @@ -9,6 +9,7 @@ import ( "github.com/samber/lo" "github.com/spf13/viper" "github.com/sujit-baniya/flash" + "go.fifitido.net/ytdl-web/version" "go.fifitido.net/ytdl-web/ytdl" "golang.org/x/exp/slog" ) @@ -19,8 +20,11 @@ func Serve() error { app.Get("/", func(c *fiber.Ctx) error { return c.Render("views/index", fiber.Map{ - "BasePath": viper.GetString("base_path"), - "Flash": flash.Get(c), + "BasePath": viper.GetString("base_path"), + "Flash": flash.Get(c), + "Version": version.Version, + "Build": version.Build, + "YtdlpVersion": ytdl.GetVersion(), }, "views/layouts/main") }) @@ -57,7 +61,13 @@ func Serve() error { }) return c.Render("views/download", fiber.Map{ - "BasePath": viper.GetString("base_path"), "Url": url, "Meta": meta, "Formats": formats, + "BasePath": viper.GetString("base_path"), + "Url": url, + "Meta": meta, + "Formats": formats, + "Version": version.Version, + "Build": version.Build, + "YtdlpVersion": ytdl.GetVersion(), }, "views/layouts/main") }) diff --git a/web/views/index.html b/web/views/index.html index 3ad3518..0d74577 100644 --- a/web/views/index.html +++ b/web/views/index.html @@ -1,6 +1,11 @@

YTDL Web

- Download videos from many different websites using yt-dlp + Download videos from over a thousand websites with the help of + yt-dlp, + a fork of youtube-dl with more features and fixes. +
+ View a complete list of supported websites + here.

diff --git a/web/views/layouts/main.html b/web/views/layouts/main.html index 70f0e9b..fd09a71 100644 --- a/web/views/layouts/main.html +++ b/web/views/layouts/main.html @@ -1,5 +1,5 @@ - + @@ -28,9 +28,12 @@ - - {{template "views/partials/navbar" .}} -
{{embed}}
+ +
+ {{template "views/partials/navbar" .}} +
{{embed}}
+
+ {{template "views/partials/footer" .}}