Skip to content

Commit

Permalink
Merge pull request #17 from SiaFoundation/alex/ui
Browse files Browse the repository at this point in the history
ui: v0.6.0
  • Loading branch information
alexfreska authored Jul 1, 2023
2 parents e807601 + 903c48f commit 370fc1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 121 deletions.
94 changes: 0 additions & 94 deletions cmd/walletd/dist/index.html

This file was deleted.

29 changes: 2 additions & 27 deletions cmd/walletd/web.go
Original file line number Diff line number Diff line change
@@ -1,44 +1,19 @@
package main

import (
"embed"
"errors"
"io/fs"
"net"
"net/http"
"strings"

"go.sia.tech/jape"
"go.sia.tech/walletd/api"
"go.sia.tech/web/walletd"
)

//go:embed dist
var dist embed.FS

type clientRouterFS struct {
fs fs.FS
}

func (cr *clientRouterFS) Open(name string) (fs.File, error) {
f, err := cr.fs.Open(name)
if errors.Is(err, fs.ErrNotExist) {
return cr.fs.Open("index.html")
}
return f, err
}

func createUIHandler() http.Handler {
assets, err := fs.Sub(dist, "dist")
if err != nil {
panic(err)
}
return http.FileServer(http.FS(&clientRouterFS{fs: assets}))
}

func startWeb(l net.Listener, node *node, password string) error {
renter := api.NewServer(node.cm, node.s, node.wm)
api := jape.BasicAuth(password)(renter)
web := createUIHandler()
web := walletd.Handler()
return http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/api") {
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/api")
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ require (
go.etcd.io/bbolt v1.3.7
go.sia.tech/core v0.1.12-0.20230623163824-788ed8e10817
go.sia.tech/jape v0.9.0
go.sia.tech/web/walletd v0.6.0
golang.org/x/term v0.6.0
lukechampine.com/frand v1.4.2
)

require (
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
go.sia.tech/web v0.0.0-20230628194305-c6e1696bad89 // indirect
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/tools v0.7.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ go.sia.tech/core v0.1.12-0.20230623163824-788ed8e10817 h1:2cAVfksJnxQpYIZK8MRbdm
go.sia.tech/core v0.1.12-0.20230623163824-788ed8e10817/go.mod h1:D17UWSn99SEfQnEaR9G9n6Kz9+BwqMoUgZ6Cl424LsQ=
go.sia.tech/jape v0.9.0 h1:kWgMFqALYhLMJYOwWBgJda5ko/fi4iZzRxHRP7pp8NY=
go.sia.tech/jape v0.9.0/go.mod h1:4QqmBB+t3W7cNplXPj++ZqpoUb2PeiS66RLpXmEGap4=
go.sia.tech/web v0.0.0-20230628194305-c6e1696bad89 h1:wB/JRFeTEs6gviB6k7QARY7Goh54ufkADsdBdn0ZhRo=
go.sia.tech/web v0.0.0-20230628194305-c6e1696bad89/go.mod h1:RKODSdOmR3VtObPAcGwQqm4qnqntDVFylbvOBbWYYBU=
go.sia.tech/web/walletd v0.6.0 h1:vhj2LkaZf7Bu350kcSGSaehSwJeuYqVefxkzqTNonU4=
go.sia.tech/web/walletd v0.6.0/go.mod h1:zfiPJGTwHjYyYGJNhjYTFn3OSJPPQkVL4nXp1M/Lhmg=
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 h1:NvGWuYG8dkDHFSKksI1P9faiVJ9rayE6l0+ouWVIDs8=
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
Expand Down

0 comments on commit 370fc1d

Please sign in to comment.