Add option to change title

This commit is contained in:
Florian Hoss 2022-10-31 16:06:43 +01:00
parent f125272722
commit 5195350174
4 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
{
"port": 4000,
"allowed_hosts": "http://localhost:4000"
"allowed_hosts": "http://localhost:4000",
"title": "GoDash"
}

View file

@ -6,7 +6,7 @@ import (
)
func (server *Server) setupRouter() {
server.Router.Get("/", goDash)
server.Router.Get("/", server.goDash)
server.Router.Get("/ws", webSocket)
server.serveStatic("static")

View file

@ -19,10 +19,10 @@ type launchpadInformation struct {
System system.System
}
func goDash(w http.ResponseWriter, r *http.Request) {
func (server *Server) goDash(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
files.ParseAndServeHtml(w, "index.gohtml", launchpadInformation{
Title: "GoDash",
Title: server.Title,
Bookmarks: bookmark.Bookmarks,
Weather: weather.CurrentWeather,
System: system.Sys,

View file

@ -10,5 +10,5 @@ type Server struct {
Hub *hub.Hub
Port int
AllowedHosts []string `mapstructure:"ALLOWED_HOSTS"`
Swagger bool
Title string
}