Add sticky footer
This commit is contained in:
parent
53a24c4726
commit
3cbc5b410b
|
@ -4,8 +4,8 @@ tmp_dir = "tmp"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
args_bin = ["-l", "0.0.0.0"]
|
args_bin = ["-l", "0.0.0.0"]
|
||||||
bin = "./tmp/main"
|
bin = "./ytdl-web"
|
||||||
cmd = "go build -o ./tmp/main ."
|
cmd = "task build"
|
||||||
delay = 1000
|
delay = 1000
|
||||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||||
exclude_file = []
|
exclude_file = []
|
||||||
|
|
10
Taskfile.yml
10
Taskfile.yml
|
@ -1,7 +1,13 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
VERSION: 1.0.0
|
||||||
|
VERSION_PKG: go.fifitido.net/ytdl-web/version
|
||||||
|
BUILD:
|
||||||
|
sh: git rev-parse --short HEAD
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
deps: go mod download
|
deps: go mod download
|
||||||
tidy: go mod tidy
|
tidy: go mod tidy
|
||||||
build: go build -o ytdl-web .
|
build: go build -ldflags="-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Build={{.BUILD}}" -o ytdl-web .
|
||||||
dev: air
|
dev: air
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package version
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
var Build string
|
16
web/serve.go
16
web/serve.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"github.com/sujit-baniya/flash"
|
"github.com/sujit-baniya/flash"
|
||||||
|
"go.fifitido.net/ytdl-web/version"
|
||||||
"go.fifitido.net/ytdl-web/ytdl"
|
"go.fifitido.net/ytdl-web/ytdl"
|
||||||
"golang.org/x/exp/slog"
|
"golang.org/x/exp/slog"
|
||||||
)
|
)
|
||||||
|
@ -19,8 +20,11 @@ func Serve() error {
|
||||||
|
|
||||||
app.Get("/", func(c *fiber.Ctx) error {
|
app.Get("/", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/index", fiber.Map{
|
return c.Render("views/index", fiber.Map{
|
||||||
"BasePath": viper.GetString("base_path"),
|
"BasePath": viper.GetString("base_path"),
|
||||||
"Flash": flash.Get(c),
|
"Flash": flash.Get(c),
|
||||||
|
"Version": version.Version,
|
||||||
|
"Build": version.Build,
|
||||||
|
"YtdlpVersion": ytdl.GetVersion(),
|
||||||
}, "views/layouts/main")
|
}, "views/layouts/main")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -57,7 +61,13 @@ func Serve() error {
|
||||||
})
|
})
|
||||||
|
|
||||||
return c.Render("views/download", fiber.Map{
|
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")
|
}, "views/layouts/main")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
<h1 class="text-center">YTDL Web</h1>
|
<h1 class="text-center">YTDL Web</h1>
|
||||||
<p class="text-center mb-5">
|
<p class="text-center mb-5">
|
||||||
Download videos from many different websites using yt-dlp
|
Download videos from over a thousand websites with the help of
|
||||||
|
<a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>,
|
||||||
|
a fork of youtube-dl with more features and fixes.
|
||||||
|
<br />
|
||||||
|
View a complete list of supported websites
|
||||||
|
<a href="https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md">here</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form action="{{.BasePath}}/download" method="get">
|
<form action="{{.BasePath}}/download" method="get">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" class="h-100">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
@ -28,9 +28,12 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-bs-theme="dark">
|
<body class="d-flex flex-column h-100" data-bs-theme="dark">
|
||||||
{{template "views/partials/navbar" .}}
|
<div class="flex-shrink-0">
|
||||||
<main class="container my-5">{{embed}}</main>
|
{{template "views/partials/navbar" .}}
|
||||||
|
<main class="container my-5">{{embed}}</main>
|
||||||
|
</div>
|
||||||
|
{{template "views/partials/footer" .}}
|
||||||
<script>
|
<script>
|
||||||
const pasteButton = document.getElementById("paste-button");
|
const pasteButton = document.getElementById("paste-button");
|
||||||
const urlField = document.getElementById("url");
|
const urlField = document.getElementById("url");
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<footer class="footer mt-auto py-3 bg-body-tertiary" style="font-size: 0.95rem">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md">
|
||||||
|
<a href="https://git.fifitido.net/apps/ytdl-web">Git Repository</a>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-4 col-md text-center">
|
||||||
|
<div class="d-flex gap-1 align-items-baseline">
|
||||||
|
Version:
|
||||||
|
<span class="text-muted">{{.Version}}</span>
|
||||||
|
<span class="text-muted" style="font-size: smaller;">(Build: {{.Build}})</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-1 align-items-baseline">
|
||||||
|
yt-dlp version: <span class="text-muted">{{.YtdlpVersion}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md text-end">
|
||||||
|
© Evan Fiordeliso 2023
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
|
@ -0,0 +1,39 @@
|
||||||
|
package ytdl
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
version string
|
||||||
|
versionOnce sync.Once
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetVersion() string {
|
||||||
|
var err error
|
||||||
|
versionOnce.Do(func() {
|
||||||
|
cmd := exec.Command(
|
||||||
|
"yt-dlp",
|
||||||
|
"--version",
|
||||||
|
)
|
||||||
|
|
||||||
|
var out bytes.Buffer
|
||||||
|
cmd.Stdout = &out
|
||||||
|
|
||||||
|
err = cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
version = strings.TrimSpace(out.String())
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return "Error getting version"
|
||||||
|
}
|
||||||
|
|
||||||
|
return version
|
||||||
|
}
|
Loading…
Reference in New Issue