assets: use statik to compile static files into binary files

This commit is contained in:
fatedier
2016-08-11 21:47:26 +08:00
parent 2d30a6e8a7
commit 32d0ce9ea0
24 changed files with 474 additions and 27 deletions

View File

@@ -19,6 +19,8 @@ import (
"net"
"net/http"
"time"
"github.com/fatedier/frp/src/assets"
)
var (
@@ -33,8 +35,9 @@ func RunDashboardServer(addr string, port int64) (err error) {
mux.HandleFunc("/api/reload", apiReload)
mux.HandleFunc("/api/proxies", apiProxies)
// view see dashboard_view.go
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./assets"))))
// view, see dashboard_view.go
mux.Handle("/favicon.ico", http.FileServer(assets.FileSystem))
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(assets.FileSystem)))
mux.HandleFunc("/", viewDashboard)
address := fmt.Sprintf("%s:%d", addr, port)