lotus/provider/lpweb/hapi/routes.go

43 lines
935 B
Go
Raw Normal View History

package hapi
import (
"embed"
"html/template"
2023-12-19 15:12:45 +00:00
"github.com/gorilla/mux"
logging "github.com/ipfs/go-log/v2"
2023-12-19 15:12:45 +00:00
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/cmd/lotus-provider/deps"
)
//go:embed web/*
var templateFS embed.FS
func Routes(r *mux.Router, deps *deps.Deps) error {
2023-12-30 15:37:04 +00:00
t, err := template.ParseFS(templateFS, "web/*")
if err != nil {
return xerrors.Errorf("parse templates: %w", err)
}
a := &app{
db: deps.DB,
t: t,
}
2024-01-12 13:09:12 +00:00
go a.watchRpc()
go a.watchActor()
r.HandleFunc("/simpleinfo/actorsummary", a.actorSummary)
r.HandleFunc("/simpleinfo/machines", a.indexMachines)
r.HandleFunc("/simpleinfo/tasks", a.indexTasks)
r.HandleFunc("/simpleinfo/taskhistory", a.indexTasksHistory)
2024-01-12 15:16:35 +00:00
r.HandleFunc("/simpleinfo/pipeline-porep", a.indexPipelinePorep)
// pipeline-porep page
r.HandleFunc("/simpleinfo/pipeline-porep/sectors", a.pipelinePorepSectors)
return nil
}
var log = logging.Logger("lpweb")