Browse Source

Revert "Merge pull request #2027 from bingoohuang/master"

Need to revert because docker image build failed. The docker apk package only has go 1.15.
pull/2045/head 2.42
Chris Lu 4 years ago
parent
commit
d74cdf0115
  1. 4
      go.mod
  2. 16
      weed/server/common.go
  3. 13
      weed/statik/statik.go
  4. 13
      weed/weed.go

4
go.mod

@ -1,6 +1,6 @@
module github.com/chrislusf/seaweedfs
go 1.16
go 1.12
require (
cloud.google.com/go v0.58.0 // indirect
@ -60,6 +60,7 @@ require (
github.com/peterh/liner v1.1.0
github.com/pierrec/lz4 v2.2.7+incompatible // indirect
github.com/prometheus/client_golang v1.3.0
github.com/rakyll/statik v0.1.7
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 // indirect
github.com/seaweedfs/fuse v1.1.4
github.com/seaweedfs/goexif v1.0.2
@ -75,6 +76,7 @@ require (
github.com/tidwall/match v1.0.1
github.com/tsuna/gohbase v0.0.0-20201125011725-348991136365
github.com/valyala/bytebufferpool v1.0.0
github.com/valyala/fasthttp v1.20.0
github.com/viant/assertly v0.5.4 // indirect
github.com/viant/ptrie v0.3.0
github.com/viant/toolbox v0.33.2 // indirect

16
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) {

13
weed/statik/statik.go
File diff suppressed because it is too large
View File

13
weed/weed.go

@ -1,12 +1,12 @@
//go:generate statik -src=./static
// install this first "go get github.com/rakyll/statik"
package main
import (
"embed"
"fmt"
weed_server "github.com/chrislusf/seaweedfs/weed/server"
flag "github.com/chrislusf/seaweedfs/weed/util/fla9"
"io"
"io/fs"
"math/rand"
"os"
"strings"
@ -35,13 +35,6 @@ func setExitStatus(n int) {
exitMu.Unlock()
}
//go:embed static
var static embed.FS
func init() {
weed_server.StaticFS, _ = fs.Sub(static, "static")
}
func main() {
glog.MaxSize = 1024 * 1024 * 32
rand.Seed(time.Now().UnixNano())

Loading…
Cancel
Save