rewrite using net/http
tronnet/workflows: Static Analysis -- Golang / static-go (push) Failing after 6s

This commit is contained in:
alu committed 2026-10-22 18:58:14 +00:00
1 parent db8ed2e830
commit 9b3ec1221e
8 files changed
+268 -148

No files matched your search

+14 -3
View File
@@ -1,6 +1,7 @@
package routes
import (
"bytes"
"fmt"
"net/http"
"proxmoxaas-dashboard/app/common"
@@ -41,10 +42,11 @@ func GetLoginRealms() ([]Realm, error) {
return realms, nil
}
func HandleGETLogin(c *gin.Context) {
func HandleGETLogin(w http.ResponseWriter, r *http.Request) {
realms, err := GetLoginRealms()
if err != nil {
common.HandleNonFatalError(c, err)
common.HandleNonFatalError(w, err)
return
}
sel := common.Select{
@@ -60,9 +62,18 @@ func HandleGETLogin(c *gin.Context) {
})
}
c.HTML(http.StatusOK, "html/login.html", gin.H{
w.Header().Set("Content-Type", "text/html")
body := bytes.Buffer{}
err = common.TMPL.ExecuteTemplate(&body, "html/login.html", gin.H{
"global": common.Global,
"page": "login",
"realms": sel,
})
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
} else {
w.Write(body.Bytes())
return
}
}