converge/pkg/server/ui/pagehandler.go
Erik Brakkee 2c42f89547 moved all ui stuff to the ui package.
The structure of converge server is now much more clear in the package
// structure below pkg/server.
2024-08-17 10:37:20 +02:00

28 lines
534 B
Go

package ui
import (
"net/http"
)
func PageHandler(w http.ResponseWriter, r *http.Request) {
access := getConvergeAccess(r)
switch r.URL.Path {
case "":
fallthrough
case "/":
fallthrough
case "index.html":
AboutTab().Render(r.Context(), w)
// TODO use contexts later.
case "usage.html":
UsageTab(access).Render(r.Context(), w)
case "downloads.html":
DownloadsTab().Render(r.Context(), w)
case "sessions.html":
SessionsTab(nil, nil, access.Location).Render(r.Context(), w)
default:
http.NotFound(w, r)
}
}