fix: Fix initial rendering of import page (#63)

Without this, the GET request on the `import` function will fail.

Reviewed-on: https://git.mills.io/prologic/tube/pulls/63
Co-authored-by: Heinrich 'Henrik' Langos <gumbo2000@noreply@mills.io>
Co-committed-by: Heinrich 'Henrik' Langos <gumbo2000@noreply@mills.io>
This commit is contained in:
Heinrich 'Henrik' Langos 2023-01-21 00:59:27 +00:00 committed by James Mills
parent 6a4ea23794
commit eba9db5be5

View file

@ -427,7 +427,13 @@ func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) {
// HTTP handler for /import // HTTP handler for /import
func (a *App) importHandler(w http.ResponseWriter, r *http.Request) { func (a *App) importHandler(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" { if r.Method == "GET" {
ctx := &struct{}{} ctx := &struct {
Config *Config
Playing *media.Video
}{
Config: a.Config,
Playing: &media.Video{ID: ""},
}
a.render("import", w, ctx) a.render("import", w, ctx)
} else if r.Method == "POST" { } else if r.Method == "POST" {
r.ParseMultipartForm(1024) r.ParseMultipartForm(1024)