From fb770573d5f3ad7c2641d825951f44766a063ca0 Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 20 Dec 2020 22:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(template):=20=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89CSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/dashboard/controller/controller.go | 4 ++-- resource/template/theme-default/home.html | 2 +- resource/template/theme-hotaru/home.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/dashboard/controller/controller.go b/cmd/dashboard/controller/controller.go index 72628bd..4c2c2ba 100644 --- a/cmd/dashboard/controller/controller.go +++ b/cmd/dashboard/controller/controller.go @@ -25,8 +25,8 @@ func ServeWeb(port uint) { "tf": func(t time.Time) string { return t.Format("2006年1月2号") }, - "css": func(s string) template.CSS { - return template.CSS(s) + "safe": func(s string) template.HTML { + return template.HTML(s) }, "tag": func(s string) template.HTML { return template.HTML(`<` + s + `>`) diff --git a/resource/template/theme-default/home.html b/resource/template/theme-default/home.html index 04d2d55..02dd0c0 100644 --- a/resource/template/theme-default/home.html +++ b/resource/template/theme-default/home.html @@ -2,7 +2,7 @@ {{template "common/header" .}} {{if ts .CustomCSS}} {{tag "style"}} -{{.CustomCSS|css}} +{{.CustomCSS|safe}} {{tag "/style"}} {{end}} {{template "common/menu" .}} diff --git a/resource/template/theme-hotaru/home.html b/resource/template/theme-hotaru/home.html index 6a55c0b..992fbbe 100644 --- a/resource/template/theme-hotaru/home.html +++ b/resource/template/theme-hotaru/home.html @@ -21,7 +21,7 @@ {{if ts .CustomCSS}} {{tag "style"}} - {{.CustomCSS|css}} + {{.CustomCSS|safe}} {{tag "/style"}} {{end}}