feat: integrate nebula UI with worker-assets-gen

This commit is contained in:
Prad Nukala
2024-10-07 21:15:25 -04:00
parent e926e5b9d6
commit af6e07323b
22 changed files with 114 additions and 101 deletions
-10
View File
@@ -1,10 +0,0 @@
package commands
import "github.com/spf13/cobra"
func NewRootCmd() *cobra.Command {
return &cobra.Command{
Use: "motr",
Short: "Manage a local DWN instance for the Sonr blockchain",
}
}
-18
View File
@@ -1,18 +0,0 @@
package commands
import (
"github.com/spf13/cobra"
"github.com/onsonr/sonr/cmd/hway/server"
)
func NewStartCmd() *cobra.Command {
return &cobra.Command{
Use: "start",
Short: "Starts the DWN proxy server for the local IPFS node",
Run: func(cmd *cobra.Command, args []string) {
s := server.New()
s.Start()
},
}
}
-13
View File
@@ -1,13 +0,0 @@
package main
import (
"github.com/onsonr/sonr/cmd/hway/commands"
)
func main() {
rootCmd := commands.NewRootCmd()
rootCmd.AddCommand(commands.NewStartCmd())
if err := rootCmd.Execute(); err != nil {
panic(err)
}
}
-1
View File
@@ -1 +0,0 @@
package handlers
-1
View File
@@ -1 +0,0 @@
package handlers
-1
View File
@@ -1 +0,0 @@
package handlers
-1
View File
@@ -1 +0,0 @@
package handlers
-40
View File
@@ -1,40 +0,0 @@
package server
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
"github.com/onsonr/sonr/internal/session"
"github.com/onsonr/sonr/pkg/nebula"
"github.com/onsonr/sonr/pkg/nebula/routes"
)
type Server struct {
*echo.Echo
}
func New() *Server {
s := &Server{Echo: echo.New()}
s.Logger.SetLevel(log.INFO)
s.Use(session.UseSession)
// Configure the server
if err := nebula.UseAssets(s.Echo); err != nil {
s.Logger.Fatal(err)
}
s.GET("/", routes.Home)
s.GET("/login", routes.LoginStart)
s.GET("/register", routes.RegisterStart)
// s.GET("/profile", router.Profile)
// s.GET("/authorize", router.Authorize)
return s
}
func (s *Server) Start() {
if err := s.Echo.Start(":1323"); err != http.ErrServerClosed {
log.Fatal(err)
}
}