Skip to content

Commit 687516d

Browse files
authored
Update controller.go
1 parent a0a217d commit 687516d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/dashboard/controller/controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/xos/serverstatus/pkg/mygin"
2222
"github.com/xos/serverstatus/pkg/utils"
2323
"github.com/xos/serverstatus/proto"
24-
"github.com/xos/serverstatus/resource"
2524
"github.com/xos/serverstatus/service/rpc"
2625
"github.com/xos/serverstatus/service/singleton"
2726
)
@@ -36,14 +35,16 @@ func ServeWeb(port uint) *http.Server {
3635
r.Use(natGateway)
3736
tmpl := template.New("").Funcs(funcMap)
3837
var err error
39-
tmpl, err = tmpl.ParseFS(resource.TemplateFS, "template/**/*.html")
38+
// 直接用本地模板目录
39+
tmpl, err = tmpl.ParseGlob("resource/template/**/*.html")
4040
if err != nil {
4141
panic(err)
4242
}
4343
tmpl = loadThirdPartyTemplates(tmpl)
4444
r.SetHTMLTemplate(tmpl)
4545
r.Use(mygin.RecordPath)
46-
r.StaticFS("/static", http.FS(resource.StaticFS))
46+
// 直接用本地静态资源目录
47+
r.Static("/static", "resource/static")
4748
routers(r)
4849
page404 := func(c *gin.Context) {
4950
mygin.ShowErrorPage(c, mygin.ErrInfo{

0 commit comments

Comments
 (0)