35 lines
536 B
Go
35 lines
536 B
Go
package web
|
|
|
|
import (
|
|
"bytes"
|
|
"html/template"
|
|
"miniwol/config"
|
|
"net/http"
|
|
)
|
|
|
|
func device(w http.ResponseWriter, r *http.Request) {
|
|
if checkAuthentication(w, r) != nil {
|
|
return
|
|
}
|
|
|
|
page := struct {
|
|
Title string
|
|
Content template.HTML
|
|
}{
|
|
Title: "Devices",
|
|
}
|
|
|
|
var contentBuffer bytes.Buffer
|
|
err := deviceTemplate.Execute(&contentBuffer, config.Config.Device)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
page.Content = template.HTML(contentBuffer.String())
|
|
|
|
err = pageTemplate.Execute(w, page)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|