This commit is contained in:
2024-12-19 14:01:14 +08:00
parent afbbf1ee31
commit 200c48a22c
15 changed files with 178 additions and 106 deletions

View File

@@ -10,3 +10,7 @@ import (
func CsrfField(r *http.Request) template.HTML {
return csrf.TemplateField(r)
}
func CsrfToken(r *http.Request) string {
return csrf.Token(r)
}

View File

@@ -2,6 +2,22 @@ package util
import "strings"
func GetResourcesFile(path ...string) ([]string, []string) {
var csses []string
var jses []string
if len(path) > 0 {
for _, p := range path {
if strings.HasSuffix(p, ".css") {
csses = append(csses, p)
} else if strings.HasSuffix(p, ".js") {
jses = append(jses, p)
}
}
}
return csses, jses
}
func GetCssFile(path ...string) []string {
var res []string
if len(path) > 0 {