diff --git a/main.go b/main.go index 84d0c41..dbc53c4 100755 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "gocv.io/x/gocv" ) +var baseHTML = filepath.Join("templates", "base.html") var indexHTML = filepath.Join("templates", "index.html") var streamHTML = filepath.Join("templates", "stream.html") @@ -22,7 +23,7 @@ type Server struct { func (server Server) index(w http.ResponseWriter, r *http.Request) { if r.FormValue("URL") == "" { - indexTemplate, err := template.ParseFiles(indexHTML) + indexTemplate, err := template.ParseFiles(indexHTML, baseHTML) if err != nil { log.Fatal(err) } @@ -36,7 +37,7 @@ func (server Server) index(w http.ResponseWriter, r *http.Request) { server.Streams[URL] = stream go stream.Update() } - streamTemplate, err := template.ParseFiles(streamHTML) + streamTemplate, err := template.ParseFiles(streamHTML, baseHTML) if err != nil { log.Fatal(err) diff --git a/templates/base.html b/templates/base.html new file mode 100755 index 0000000..c8e74fb --- /dev/null +++ b/templates/base.html @@ -0,0 +1,10 @@ +{{define "base"}} + +
+