2018-06-20 23:47:47 +02:00
|
|
|
package webcontroller
|
|
|
|
|
|
|
|
import (
|
2018-06-21 23:41:50 +02:00
|
|
|
"html/template"
|
2018-06-20 23:47:47 +02:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TemplateData is a struct that every template expects when being rendered. In
|
|
|
|
// the field Other you can pass your own template-specific variables.
|
|
|
|
type TemplateData struct {
|
|
|
|
Authenticated bool
|
|
|
|
Username string
|
2018-06-21 23:41:50 +02:00
|
|
|
APIEndpoint template.URL
|
2018-06-20 23:47:47 +02:00
|
|
|
|
|
|
|
Recaptcha struct {
|
|
|
|
Enabled bool
|
|
|
|
PubKey string
|
|
|
|
}
|
|
|
|
|
|
|
|
Other interface{}
|
|
|
|
}
|
|
|
|
|
2018-06-21 23:41:50 +02:00
|
|
|
func (wc *WebController) newTemplateData(r *http.Request) *TemplateData {
|
|
|
|
var t = &TemplateData{
|
|
|
|
Authenticated: false,
|
|
|
|
Username: "Fornax",
|
|
|
|
APIEndpoint: template.URL(wc.conf.APIURLExternal),
|
|
|
|
}
|
2018-06-20 23:47:47 +02:00
|
|
|
|
|
|
|
return t
|
|
|
|
}
|