up
This commit is contained in:
parent
67ba36abd4
commit
4f6051d1e6
@ -4,6 +4,7 @@ import (
|
||||
"app/shelfly/internal/debridlink"
|
||||
"app/shelfly/internal/download"
|
||||
"app/shelfly/internal/models"
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@ -1146,10 +1147,16 @@ func HLSStream(db *gorm.DB) http.HandlerFunc {
|
||||
|
||||
|
||||
func renderPartial(w http.ResponseWriter, templ string, data map[string]interface{}) {
|
||||
// Exécute directement le define `<templ>.pages.tmpl`
|
||||
if err := templates.ExecuteTemplate(w, templ+".pages.tmpl", data); err != nil {
|
||||
var buf bytes.Buffer
|
||||
// Exécute la template dans le buffer
|
||||
if err := templates.ExecuteTemplate(&buf, templ+".pages.tmpl", data); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
// On peut définir un content-type explicite si besoin
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
// Écriture unique du code 200 implicite et du corps
|
||||
w.Write(buf.Bytes())
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, templ string, data map[string]interface{}) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user