diff --git a/cmd/lotus-provider/rpc/rpc.go b/cmd/lotus-provider/rpc/rpc.go index d77d8c81e..e2897030f 100644 --- a/cmd/lotus-provider/rpc/rpc.go +++ b/cmd/lotus-provider/rpc/rpc.go @@ -21,10 +21,10 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/cmd/lotus-provider/deps" - "github.com/filecoin-project/lotus/cmd/lotus-provider/web" "github.com/filecoin-project/lotus/lib/rpcenc" "github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics/proxy" + "github.com/filecoin-project/lotus/provider/lpweb" "github.com/filecoin-project/lotus/storage/paths" ) @@ -79,7 +79,6 @@ func (p *ProviderAPI) Shutdown(context.Context) error { } func ListenAndServe(ctx context.Context, dependencies *deps.Deps, shutdownChan chan struct{}) error { - fh := &paths.FetchHandler{Local: dependencies.LocalStore, PfHandler: &paths.DefaultPartialFileHandler{}} remoteHandler := func(w http.ResponseWriter, r *http.Request) { if !auth.HasPerm(r.Context(), nil, api.PermAdmin) { @@ -133,7 +132,7 @@ func ListenAndServe(ctx context.Context, dependencies *deps.Deps, shutdownChan c eg.Go(srv.ListenAndServe) if dependencies.Cfg.Subsystems.EnableWebGui { - web, err := web.GetSrv(ctx, dependencies) + web, err := lpweb.GetSrv(ctx, dependencies) if err != nil { return err } diff --git a/cmd/lotus-provider/run.go b/cmd/lotus-provider/run.go index 0f18f2843..b1a4ff828 100644 --- a/cmd/lotus-provider/run.go +++ b/cmd/lotus-provider/run.go @@ -1,14 +1,12 @@ package main import ( - "bytes" "context" "fmt" "os" "strings" "time" - "github.com/BurntSushi/toml" "github.com/pkg/errors" "github.com/urfave/cli/v2" "go.opencensus.io/stats" @@ -22,7 +20,6 @@ import ( "github.com/filecoin-project/lotus/lib/ulimit" "github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/node" - "github.com/filecoin-project/lotus/node/config" ) type stackTracer interface { @@ -174,13 +171,11 @@ var webCmd = &cli.Command{ webtxt, err := getConfig(db, "web") if err != nil || webtxt == "" { - cfg := config.DefaultLotusProvider() - cfg.Subsystems.EnableWebGui = true - var b bytes.Buffer - if err = toml.NewEncoder(&b).Encode(cfg); err != nil { - return err - } - if err = setConfig(db, "web", b.String()); err != nil { + + s := `[Susbystems] + EnableWebGui = true + ` + if err = setConfig(db, "web", s); err != nil { return err } } diff --git a/cmd/lotus-provider/web/api/debug/debug.go b/provider/lpweb/api/debug/debug.go similarity index 100% rename from cmd/lotus-provider/web/api/debug/debug.go rename to provider/lpweb/api/debug/debug.go diff --git a/cmd/lotus-provider/web/api/routes.go b/provider/lpweb/api/routes.go similarity index 80% rename from cmd/lotus-provider/web/api/routes.go rename to provider/lpweb/api/routes.go index 9bb6fb67c..85b17486f 100644 --- a/cmd/lotus-provider/web/api/routes.go +++ b/provider/lpweb/api/routes.go @@ -5,7 +5,7 @@ import ( "github.com/gorilla/mux" "github.com/filecoin-project/lotus/cmd/lotus-provider/deps" - "github.com/filecoin-project/lotus/cmd/lotus-provider/web/api/debug" + "github.com/filecoin-project/lotus/provider/lpweb/api/debug" ) func Routes(r *mux.Router, deps *deps.Deps) { diff --git a/cmd/lotus-provider/web/hapi/routes.go b/provider/lpweb/hapi/routes.go similarity index 100% rename from cmd/lotus-provider/web/hapi/routes.go rename to provider/lpweb/hapi/routes.go diff --git a/cmd/lotus-provider/web/hapi/simpleinfo.go b/provider/lpweb/hapi/simpleinfo.go similarity index 98% rename from cmd/lotus-provider/web/hapi/simpleinfo.go rename to provider/lpweb/hapi/simpleinfo.go index a14735a84..ee36a1e17 100644 --- a/cmd/lotus-provider/web/hapi/simpleinfo.go +++ b/provider/lpweb/hapi/simpleinfo.go @@ -82,7 +82,7 @@ var templateDev = os.Getenv("LOTUS_WEB_DEV") == "1" func (a *app) executeTemplate(w http.ResponseWriter, name string, data interface{}) { if templateDev { fs := os.DirFS("./cmd/lotus-provider/web/hapi/web") - a.t = template.Must(template.ParseFS(fs, "web/*")) + a.t = template.Must(template.ParseFS(fs, "*")) } if err := a.t.ExecuteTemplate(w, name, data); err != nil { log.Errorf("execute template %s: %v", name, err) diff --git a/cmd/lotus-provider/web/hapi/web/actor_summary.gohtml b/provider/lpweb/hapi/web/actor_summary.gohtml similarity index 100% rename from cmd/lotus-provider/web/hapi/web/actor_summary.gohtml rename to provider/lpweb/hapi/web/actor_summary.gohtml diff --git a/cmd/lotus-provider/web/hapi/web/chain_rpcs.gohtml b/provider/lpweb/hapi/web/chain_rpcs.gohtml similarity index 100% rename from cmd/lotus-provider/web/hapi/web/chain_rpcs.gohtml rename to provider/lpweb/hapi/web/chain_rpcs.gohtml diff --git a/cmd/lotus-provider/web/hapi/web/cluster_machines.gohtml b/provider/lpweb/hapi/web/cluster_machines.gohtml similarity index 100% rename from cmd/lotus-provider/web/hapi/web/cluster_machines.gohtml rename to provider/lpweb/hapi/web/cluster_machines.gohtml diff --git a/cmd/lotus-provider/web/hapi/web/cluster_task_history.gohtml b/provider/lpweb/hapi/web/cluster_task_history.gohtml similarity index 100% rename from cmd/lotus-provider/web/hapi/web/cluster_task_history.gohtml rename to provider/lpweb/hapi/web/cluster_task_history.gohtml diff --git a/cmd/lotus-provider/web/hapi/web/cluster_tasks.gohtml b/provider/lpweb/hapi/web/cluster_tasks.gohtml similarity index 100% rename from cmd/lotus-provider/web/hapi/web/cluster_tasks.gohtml rename to provider/lpweb/hapi/web/cluster_tasks.gohtml diff --git a/cmd/lotus-provider/web/srv.go b/provider/lpweb/srv.go similarity index 90% rename from cmd/lotus-provider/web/srv.go rename to provider/lpweb/srv.go index 55d20cc9a..f6bcfcf85 100644 --- a/cmd/lotus-provider/web/srv.go +++ b/provider/lpweb/srv.go @@ -1,5 +1,5 @@ -// Package web defines the HTTP web server for static files and endpoints. -package web +// Package lpweb defines the HTTP web server for static files and endpoints. +package lpweb import ( "context" @@ -17,9 +17,9 @@ import ( "go.opencensus.io/tag" "github.com/filecoin-project/lotus/cmd/lotus-provider/deps" - "github.com/filecoin-project/lotus/cmd/lotus-provider/web/api" - "github.com/filecoin-project/lotus/cmd/lotus-provider/web/hapi" "github.com/filecoin-project/lotus/metrics" + "github.com/filecoin-project/lotus/provider/lpweb/api" + "github.com/filecoin-project/lotus/provider/lpweb/hapi" ) //go:embed static diff --git a/cmd/lotus-provider/web/static/chain-connectivity.js b/provider/lpweb/static/chain-connectivity.js similarity index 100% rename from cmd/lotus-provider/web/static/chain-connectivity.js rename to provider/lpweb/static/chain-connectivity.js diff --git a/cmd/lotus-provider/web/static/index.html b/provider/lpweb/static/index.html similarity index 100% rename from cmd/lotus-provider/web/static/index.html rename to provider/lpweb/static/index.html