Skip to content

Commit

Permalink
Merge pull request #448 from fairDataSociety/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
asabya authored Mar 29, 2023
2 parents 60e7c88 + 2713706 commit ece8eec
Show file tree
Hide file tree
Showing 116 changed files with 6,955 additions and 1,279 deletions.
4 changes: 0 additions & 4 deletions cmd/dfs-cli/cmd/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ func statFileOrDirectory(podName, statElement string) {
fmt.Println("Cr. Time : ", time.Unix(crTime, 0).String())
fmt.Println("Mo. Time : ", time.Unix(accTime, 0).String())
fmt.Println("Ac. Time : ", time.Unix(modTime, 0).String())
for _, b := range resp.Blocks {
blkStr := fmt.Sprintf("0x%s, %s bytes, %s bytes", b.Reference, b.Size, b.CompressedSize)
fmt.Println(blkStr)
}
} else {
fmt.Println("stat: ", err)
return
Expand Down
25 changes: 19 additions & 6 deletions cmd/dfs/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ can consume it.`,
return fmt.Errorf("postageBlockId is invalid")
}
}
ensConfig := &contracts.Config{}
ensConfig := &contracts.ENSConfig{}
var subscriptionConfig *contracts.SubscriptionConfig
network := config.GetString("network")
rpc := config.GetString(optionRPC)
if rpc == "" {
Expand Down Expand Up @@ -152,7 +153,7 @@ can consume it.`,
return fmt.Errorf("ensRegistry contract address is missing")
}

ensConfig = &contracts.Config{
ensConfig = &contracts.ENSConfig{
ENSRegistryAddress: ensRegistryAddress,
FDSRegistrarAddress: fdsRegistrarAddress,
PublicResolverAddress: publicResolverAddress,
Expand All @@ -164,12 +165,15 @@ can consume it.`,
fmt.Println("\nens is not available for mainnet yet")
return fmt.Errorf("ens is not available for mainnet yet")
case "testnet":
ensConfig = contracts.TestnetConfig()
ensConfig, subscriptionConfig = contracts.TestnetConfig()
case "play":
ensConfig = contracts.PlayConfig()
ensConfig, subscriptionConfig = contracts.PlayConfig()
}
}
ensConfig.ProviderBackend = rpc
if subscriptionConfig != nil {
subscriptionConfig.RPC = rpc
}
var logger logging.Logger
switch v := strings.ToLower(verbosity); v {
case "0", "silent":
Expand Down Expand Up @@ -202,8 +206,8 @@ can consume it.`,

ctx, cancel := context.WithCancel(cmd.Context())
defer cancel()
// datadir will be removed in some future version. it is kept for migration purpose only
hdlr, err := api.New(ctx, beeApi, cookieDomain, postageBlockId, corsOrigins, ensConfig, logger)

hdlr, err := api.New(ctx, beeApi, cookieDomain, postageBlockId, corsOrigins, ensConfig, nil, logger)
if err != nil {
logger.Error(err.Error())
return err
Expand Down Expand Up @@ -271,6 +275,15 @@ func startHttpService(logger logging.Logger) *http.Server {
httpSwagger.URL("./swagger/doc.json"),
)).Methods(http.MethodGet)
}
router.HandleFunc("/public-file", handler.PublicPodGetFileHandler)
router.HandleFunc("/public-dir", handler.PublicPodGetDirHandler)
router.HandleFunc("/public-kv", handler.PublicPodKVEntryGetHandler)

redirectHandler := func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, r.URL.Path+"/", http.StatusMovedPermanently)
}
router.HandleFunc("/public/{ref}", redirectHandler)
router.HandleFunc("/public/{ref}/{file:.*}", handler.PublicPodFilePathHandler)

apiVersion := "v1"

Expand Down
2 changes: 1 addition & 1 deletion cmd/dfs/cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func TestApis(t *testing.T) {
t.Fatal(err)
}
if renameResp.StatusCode != 200 {
t.Fatal("rename failed", u)
t.Fatal("rename failed", u, renameResp.StatusCode)
}
}

Expand Down
36 changes: 18 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/btcsuite/btcd v0.22.3
github.com/c-bata/go-prompt v0.2.6
github.com/dustin/go-humanize v1.0.1
github.com/ethereum/go-ethereum v1.11.1
github.com/ethereum/go-ethereum v1.11.4
github.com/ethersphere/bee v1.12.0
github.com/ethersphere/bmt v0.1.4
github.com/fairdatasociety/fairOS-dfs-utils v0.0.0-20221230123929-aec4ed8b854d
Expand All @@ -15,7 +15,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/websocket v1.5.0
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/hashicorp/golang-lru v0.6.0
github.com/klauspost/pgzip v1.2.5
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/mitchellh/go-homedir v1.1.0
Expand All @@ -24,15 +24,15 @@ require (
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/swaggo/http-swagger v1.3.3
github.com/stretchr/testify v1.8.2
github.com/swaggo/http-swagger v1.3.4
github.com/swaggo/swag v1.8.10
github.com/tinygrasshopper/bettercsv v0.0.1
github.com/tyler-smith/go-bip39 v1.1.0
github.com/wealdtech/go-ens/v3 v3.5.5
go.uber.org/goleak v1.2.0
golang.org/x/crypto v0.1.0
golang.org/x/term v0.5.0
go.uber.org/goleak v1.2.1
golang.org/x/crypto v0.4.0
golang.org/x/term v0.6.0
gopkg.in/yaml.v2 v2.4.0
resenje.org/jsonhttp v0.2.0
)
Expand All @@ -44,7 +44,7 @@ require (
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
Expand All @@ -55,10 +55,10 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/ipfs/go-cid v0.2.0 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.0.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand All @@ -68,11 +68,11 @@ require (
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.0.4 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/multiformats/go-multihash v0.2.0 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/term v1.2.0-beta.2 // indirect
Expand All @@ -90,11 +90,11 @@ require (
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/wealdtech/go-multicodec v1.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sys v0.5.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/tools v0.3.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit ece8eec

Please sign in to comment.