This commit is contained in:
Liang Ding 2022-12-08 23:19:03 +08:00
parent 442c675be0
commit f5943cac15
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 53 additions and 11 deletions

View file

@ -17,7 +17,9 @@
package server
import (
"bytes"
"fmt"
"html/template"
"net"
"net/http"
"net/http/httputil"
@ -267,6 +269,27 @@ func serveCheckAuth(c *gin.Context) {
c.Status(500)
return
}
tpl, err := template.New("auth").Parse(string(data))
if nil != err {
logging.LogErrorf("parse auth page failed: %s", err)
c.Status(500)
return
}
model := map[string]interface{}{
"l0": model.Conf.Language(173),
"l1": model.Conf.Language(174),
"l2": template.HTML(model.Conf.Language(172)),
"l3": model.Conf.Language(175),
}
buf := &bytes.Buffer{}
if err = tpl.Execute(buf, model); nil != err {
logging.LogErrorf("execute auth page failed: %s", err)
c.Status(500)
return
}
data = buf.Bytes()
c.Data(http.StatusOK, "text/html; charset=utf-8", data)
}