You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
575 B
31 lines
575 B
package PageHandlers
|
|
|
|
import (
|
|
_ "embed"
|
|
"fmt"
|
|
"net/http"
|
|
"strconv"
|
|
"ytdlp-viewer/DirectoryIndexers"
|
|
)
|
|
|
|
type IndexPageData struct {
|
|
FileCount string
|
|
Files map[string]DirectoryIndexers.VideoFile
|
|
}
|
|
|
|
func Index(writer http.ResponseWriter, request *http.Request, FL *DirectoryIndexers.FileList) {
|
|
FL.RLock()
|
|
defer FL.RUnlock()
|
|
|
|
data := IndexPageData{
|
|
FileCount: strconv.Itoa(len(FL.Files)),
|
|
Files: FL.Files,
|
|
}
|
|
|
|
fmt.Println(tmpl["index.html"].Name())
|
|
|
|
err := tmpl["index.html"].ExecuteTemplate(writer, "base", data)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
}
|
|
|