add bootstrap js. Not sure if it is useful for now
This commit is contained in:
parent
911a55b502
commit
dc20e1ea30
1
Makefile
1
Makefile
@ -1,6 +1,7 @@
|
||||
|
||||
update-bootstrap:
|
||||
curl -L "https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" -o assets/bootstrap.min.css
|
||||
curl -L "https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.min.js" -o assets/bootstrap.min.js
|
||||
|
||||
build:
|
||||
go build .
|
||||
|
7
assets/bootstrap.min.js
vendored
Normal file
7
assets/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
main.go
13
main.go
@ -80,7 +80,10 @@ func main() {
|
||||
}
|
||||
defer d.Save()
|
||||
|
||||
assets := []string{"assets/bootstrap.min.css"}
|
||||
assets := []string{
|
||||
"assets/bootstrap.min.css",
|
||||
"assets/bootstrap.min.js",
|
||||
}
|
||||
|
||||
if saveAssets {
|
||||
for _, assetFile := range assets {
|
||||
@ -288,24 +291,24 @@ func downloadYt(id int, yturl string, pc chan<- string) (string, error) {
|
||||
var fname string
|
||||
if err != nil {
|
||||
pc <- "Download Error"
|
||||
return "", fmt.Errorf("Download Error, err: %w", err)
|
||||
return "", fmt.Errorf("download Error, err: %w", err)
|
||||
}
|
||||
pc <- "Download Done, renaming"
|
||||
matches, err := fs.Glob(os.DirFS(cachePath), fmt.Sprintf("video_%d.*", id))
|
||||
if err != nil {
|
||||
pc <- "Match Error"
|
||||
return "", fmt.Errorf("Glob match error, err: %w\n", err)
|
||||
return "", fmt.Errorf("glob match error, err: %w", err)
|
||||
}
|
||||
if len(matches) != 1 {
|
||||
pc <- "Multiple Match Error"
|
||||
return "", fmt.Errorf("Got multiple matches, count: %v", len(matches))
|
||||
return "", fmt.Errorf("got multiple matches, count: %v", len(matches))
|
||||
}
|
||||
fname = matches[0]
|
||||
source := path.Join(cachePath, fname)
|
||||
destination := path.Join(videosPath, fname)
|
||||
if err := os.Rename(source, destination); err != nil {
|
||||
pc <- "Rename error"
|
||||
return "", fmt.Errorf("Rename error, fname: %q, source: %q, destination: %q, err: %w\n", fname, source, destination, err)
|
||||
return "", fmt.Errorf("rename error, fname: %q, source: %q, destination: %q, err: %w", fname, source, destination, err)
|
||||
}
|
||||
return fname, nil
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<script src="assets/bootstrap.min.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="text-center">{{ $.Title }}</h1>
|
||||
|
Loading…
Reference in New Issue
Block a user