剔除更多的模板变量
This commit is contained in:
@@ -12,6 +12,6 @@
|
||||
{{ if eq .Code 404 }}<h1>404 Not Found</h1>{{ else }}<h1>500 Unknown Error</h1>{{ end }}
|
||||
</div>
|
||||
<hr>
|
||||
<div style="text-align: center;">Gitea Pages/{{ .UUID }}</div>
|
||||
<div style="text-align: center;">Gitea Pages({{.Request.Host}})/{{ .UUID }}</div>
|
||||
</Body>
|
||||
</html>
|
||||
@@ -13,15 +13,14 @@ func NewTemplateInject(r *http.Request, def map[string]any) map[string]any {
|
||||
def = make(map[string]any)
|
||||
}
|
||||
headers := make(map[string]string)
|
||||
for k, vs := range r.Header {
|
||||
for k, vs := range r.Header.Clone() {
|
||||
headers[k] = strings.Join(vs, ",")
|
||||
}
|
||||
def["Request"] = map[string]any{
|
||||
"Headers": headers,
|
||||
"Host": r.Host,
|
||||
"Path": r.URL.Path,
|
||||
"Params": r.URL.Query(),
|
||||
"Method": r.Method,
|
||||
"RequestURI": r.RequestURI,
|
||||
"RemoteAddr": r.RemoteAddr,
|
||||
"RemoteIP": GetRemoteIP(r),
|
||||
}
|
||||
return def
|
||||
|
||||
Reference in New Issue
Block a user