v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
14 changed files with 13 additions and 19 deletions
Showing only changes of commit 5091434f30 - Show all commits

View File

@ -21,10 +21,10 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/cmd/lotus-provider/deps" "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/lib/rpcenc"
"github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics"
"github.com/filecoin-project/lotus/metrics/proxy" "github.com/filecoin-project/lotus/metrics/proxy"
"github.com/filecoin-project/lotus/provider/lpweb"
"github.com/filecoin-project/lotus/storage/paths" "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 { func ListenAndServe(ctx context.Context, dependencies *deps.Deps, shutdownChan chan struct{}) error {
fh := &paths.FetchHandler{Local: dependencies.LocalStore, PfHandler: &paths.DefaultPartialFileHandler{}} fh := &paths.FetchHandler{Local: dependencies.LocalStore, PfHandler: &paths.DefaultPartialFileHandler{}}
remoteHandler := func(w http.ResponseWriter, r *http.Request) { remoteHandler := func(w http.ResponseWriter, r *http.Request) {
if !auth.HasPerm(r.Context(), nil, api.PermAdmin) { 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) eg.Go(srv.ListenAndServe)
if dependencies.Cfg.Subsystems.EnableWebGui { if dependencies.Cfg.Subsystems.EnableWebGui {
web, err := web.GetSrv(ctx, dependencies) web, err := lpweb.GetSrv(ctx, dependencies)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,14 +1,12 @@
package main package main
import ( import (
"bytes"
"context" "context"
"fmt" "fmt"
"os" "os"
"strings" "strings"
"time" "time"
"github.com/BurntSushi/toml"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.opencensus.io/stats" "go.opencensus.io/stats"
@ -22,7 +20,6 @@ import (
"github.com/filecoin-project/lotus/lib/ulimit" "github.com/filecoin-project/lotus/lib/ulimit"
"github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/config"
) )
type stackTracer interface { type stackTracer interface {
@ -174,13 +171,11 @@ var webCmd = &cli.Command{
webtxt, err := getConfig(db, "web") webtxt, err := getConfig(db, "web")
if err != nil || webtxt == "" { if err != nil || webtxt == "" {
cfg := config.DefaultLotusProvider()
cfg.Subsystems.EnableWebGui = true s := `[Susbystems]
var b bytes.Buffer EnableWebGui = true
if err = toml.NewEncoder(&b).Encode(cfg); err != nil { `
return err if err = setConfig(db, "web", s); err != nil {
}
if err = setConfig(db, "web", b.String()); err != nil {
return err return err
} }
} }

View File

@ -5,7 +5,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/filecoin-project/lotus/cmd/lotus-provider/deps" "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) { func Routes(r *mux.Router, deps *deps.Deps) {

View File

@ -82,7 +82,7 @@ var templateDev = os.Getenv("LOTUS_WEB_DEV") == "1"
func (a *app) executeTemplate(w http.ResponseWriter, name string, data interface{}) { func (a *app) executeTemplate(w http.ResponseWriter, name string, data interface{}) {
if templateDev { if templateDev {
fs := os.DirFS("./cmd/lotus-provider/web/hapi/web") 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 { if err := a.t.ExecuteTemplate(w, name, data); err != nil {
log.Errorf("execute template %s: %v", name, err) log.Errorf("execute template %s: %v", name, err)

View File

@ -1,5 +1,5 @@
// Package web defines the HTTP web server for static files and endpoints. // Package lpweb defines the HTTP web server for static files and endpoints.
package web package lpweb
import ( import (
"context" "context"
@ -17,9 +17,9 @@ import (
"go.opencensus.io/tag" "go.opencensus.io/tag"
"github.com/filecoin-project/lotus/cmd/lotus-provider/deps" "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/metrics"
"github.com/filecoin-project/lotus/provider/lpweb/api"
"github.com/filecoin-project/lotus/provider/lpweb/hapi"
) )
//go:embed static //go:embed static