diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-04-30 03:36:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-04-30 03:36:15 -0700 |
| commit | d74cdf011553ae073d524a080f65f418c76ccaa7 (patch) | |
| tree | a264d490c7244bba0feb4072215ad44d779d1146 /weed/server/common.go | |
| parent | 84312e679957a5107735136a731862c7dd297ba7 (diff) | |
| download | seaweedfs-d74cdf011553ae073d524a080f65f418c76ccaa7.tar.xz seaweedfs-d74cdf011553ae073d524a080f65f418c76ccaa7.zip | |
Revert "Merge pull request #2027 from bingoohuang/master"2.42
Need to revert because docker image build failed. The docker apk package only has go 1.15.
Diffstat (limited to 'weed/server/common.go')
| -rw-r--r-- | weed/server/common.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/weed/server/common.go b/weed/server/common.go index 571944c10..5c5f1b8eb 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io" - "io/fs" "mime/multipart" "net/http" "path/filepath" @@ -22,14 +21,19 @@ import ( "github.com/chrislusf/seaweedfs/weed/util" "github.com/gorilla/mux" + statik "github.com/rakyll/statik/fs" + + _ "github.com/chrislusf/seaweedfs/weed/statik" ) var serverStats *stats.ServerStats var startTime = time.Now() +var statikFS http.FileSystem func init() { serverStats = stats.NewServerStats() go serverStats.Start() + statikFS, _ = statik.New() } func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj interface{}) (err error) { @@ -208,16 +212,14 @@ func statsMemoryHandler(w http.ResponseWriter, r *http.Request) { writeJsonQuiet(w, r, http.StatusOK, m) } -var StaticFS fs.FS - func handleStaticResources(defaultMux *http.ServeMux) { - defaultMux.Handle("/favicon.ico", http.FileServer(http.FS(StaticFS))) - defaultMux.Handle("/seaweedfsstatic/", http.StripPrefix("/seaweedfsstatic", http.FileServer(http.FS(StaticFS)))) + defaultMux.Handle("/favicon.ico", http.FileServer(statikFS)) + defaultMux.Handle("/seaweedfsstatic/", http.StripPrefix("/seaweedfsstatic", http.FileServer(statikFS))) } func handleStaticResources2(r *mux.Router) { - r.Handle("/favicon.ico", http.FileServer(http.FS(StaticFS))) - r.PathPrefix("/seaweedfsstatic/").Handler(http.StripPrefix("/seaweedfsstatic", http.FileServer(http.FS(StaticFS)))) + r.Handle("/favicon.ico", http.FileServer(statikFS)) + r.PathPrefix("/seaweedfsstatic/").Handler(http.StripPrefix("/seaweedfsstatic", http.FileServer(statikFS))) } func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, filename string) { |
