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/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
}

View File

@ -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
}
}

View File

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

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

View File

@ -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