// package templates handles Go html/template rendering for the site and admin panel. // // This is a placeholder implementation. Actual templates will be added // when the web UI is designed. package templates import ( "html/template" "log" "net/http" "os" "path/filepath" "gitea.mrixs.me/Mrixs/MrixsCraft-server/internal/config" "gitea.mrixs.me/Mrixs/MrixsCraft-server/internal/database" ) // Handler serves template-rendered pages. type Handler struct { db *database.DB cfg *config.Config layout *template.Template } // NewHandler creates a new templates handler and parses embedded/ondisk templates. func NewHandler(db *database.DB, cfg *config.Config) *Handler { h := &Handler{db: db, cfg: cfg} h.parseTemplates() return h } // RegisterRoutes mounts template-rendered pages. func (h *Handler) RegisterRoutes(mux *http.ServeMux) { mux.HandleFunc("GET /", h.index) mux.HandleFunc("GET /login", h.loginPage) mux.HandleFunc("GET /register", h.registerPage) } // ── Page handlers ────────────────────────────────────────────── func (h *Handler) index(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { http.NotFound(w, r) return } if h.layout == nil { w.WriteHeader(http.StatusOK) w.Write([]byte("