MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / httpsIndex

Function httpsIndex

internal/web/admin.https.go:13–37  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

11)
12
13func httpsIndex(w http.ResponseWriter, r *http.Request) {
14 tmlPath := configs.GetFilePathsConfig().AdminHtml.String()
15 tmpl, err := template.New("https.html").Funcs(funcMap).ParseFiles(
16 util.FilePath(tmlPath+"/_header.html"),
17 util.FilePath(tmlPath+"/_nav.html"),
18 util.FilePath(tmlPath+"/https.html"),
19 util.FilePath(tmlPath+"/_footer.html"),
20 )
21 if err != nil {
22 mudlog.Error("HTML Template", "error", err)
23 http.Error(w, "Error parsing template files", http.StatusInternalServerError)
24 return
25 }
26
27 tplData := map[string]any{
28 "NAV": buildAdminNav(),
29 "AUTHED_USER": GetAuthedUser(r),
30 "httpsStatus": GetHTTPSStatus(),
31 }
32
33 w.Header().Set("Cache-Control", "no-store")
34 if err := tmpl.Execute(w, tplData); err != nil {
35 mudlog.Error("HTML Execute", "error", err)
36 }
37}

Calls 9

GetFilePathsConfigFunction · 0.92
FilePathFunction · 0.92
ErrorFunction · 0.92
buildAdminNavFunction · 0.85
GetAuthedUserFunction · 0.85
GetHTTPSStatusFunction · 0.85
NewMethod · 0.80
StringMethod · 0.65
SetMethod · 0.65