diff --git a/pkg/dfs/act_api.go b/pkg/dfs/act_api.go index a23965c4..28553f7f 100644 --- a/pkg/dfs/act_api.go +++ b/pkg/dfs/act_api.go @@ -74,7 +74,6 @@ func (a *API) OpenACTPod(sessionId, actName string) error { if err != nil { return err } - info, err := ui.GetPod().ReceivePodInfo(utils.NewReference(addr.Bytes())) if err != nil { return err diff --git a/pkg/dfs/api.go b/pkg/dfs/api.go index c3ff06a7..c2f7cc30 100644 --- a/pkg/dfs/api.go +++ b/pkg/dfs/api.go @@ -79,6 +79,11 @@ func NewDfsAPI(ctx context.Context, opts *Options) (*API, error) { logger.Errorf("dfs: bee client initialisation failed") return nil, errBeeClient } + // Setting cache size 0 will disable the cache. This is to change the default behaviour of lru itself. + // We have this -1 check hard coded in the feed package. -1 will disable the feed pool off. and write directly to swarm. + if opts.FeedCacheSize == 0 { + opts.FeedCacheSize = -1 + } users := user.NewUsers(c, ens, opts.FeedCacheSize, opts.FeedCacheTTL, logger) var sm subscriptionManager.SubscriptionManager @@ -91,12 +96,6 @@ func NewDfsAPI(ctx context.Context, opts *Options) (*API, error) { } } - // Setting cache size 0 will disable the cache. This is to change the default behaviour of lru itself. - // We have this -1 check hard coded in the feed package. -1 will disable the feed pool off. and write directly to swarm. - if opts.FeedCacheSize == 0 { - opts.FeedCacheSize = -1 - } - // discard tm logs as it creates too much noise tmLogger := logging.New(io.Discard, 0) ctx2, cancel := context.WithCancel(ctx) diff --git a/pkg/dfs/pod_api.go b/pkg/dfs/pod_api.go index 972b7c03..e7a737f5 100644 --- a/pkg/dfs/pod_api.go +++ b/pkg/dfs/pod_api.go @@ -51,7 +51,6 @@ func (a *API) CreatePod(podName, sessionId string) (*pod.Info, error) { if ui == nil { return nil, ErrUserNotLoggedIn } - // open the pod pi, err := a.prepareOwnPod(ui, podName) if err != nil { diff --git a/pkg/feed/handler.go b/pkg/feed/handler.go index 3479bdab..7978d120 100644 --- a/pkg/feed/handler.go +++ b/pkg/feed/handler.go @@ -297,7 +297,6 @@ retry: } return epoch, nil, err } - return req.Epoch, address, nil } diff --git a/pkg/pod/new.go b/pkg/pod/new.go index 26bd0aec..a3ea7f1c 100644 --- a/pkg/pod/new.go +++ b/pkg/pod/new.go @@ -42,7 +42,6 @@ func (p *Pod) CreatePod(podName, addressString, podPassword string) (*Info, erro if err != nil { return nil, err } - // check if pods is present and get free index podList, err := p.PodList() if err != nil { // skipcq: TCV-001 @@ -56,7 +55,6 @@ func (p *Pod) CreatePod(podName, addressString, podPassword string) (*Info, erro for _, pod := range podList.SharedPods { sharedPods[pod.Address] = pod.Name } - var accountInfo *account.Info var fd *feed.API var file *f.File diff --git a/wasm/main.go b/wasm/main.go index 05ba20d2..0cbf0d78 100644 --- a/wasm/main.go +++ b/wasm/main.go @@ -17,6 +17,8 @@ import ( "strings" "syscall/js" + "github.com/ethereum/go-ethereum/crypto" + "github.com/btcsuite/btcd/btcec/v2" "github.com/dustin/go-humanize" "github.com/fairdatasociety/fairOS-dfs/pkg/act" @@ -201,6 +203,7 @@ func connect(_ js.Value, funcArgs []js.Value) interface{} { EnsConfig: config, SubscriptionConfig: subConfig, Logger: logger, + FeedCacheSize: 0, } api, err = dfs.NewDfsAPI( ctx, @@ -294,7 +297,7 @@ func login(_ js.Value, funcArgs []js.Value) interface{} { go func() { loginResp, err := api.LoginUserV2(username, password, "") if err != nil { - reject.Invoke(fmt.Sprintf("Failed to create user : %s", err.Error())) + reject.Invoke(fmt.Sprintf("Failed to login : %s", err.Error())) return } ui, nameHash := loginResp.UserInfo, loginResp.NameHash @@ -303,6 +306,7 @@ func login(_ js.Value, funcArgs []js.Value) interface{} { addr := ui.GetAccount().GetUserAccountInfo().GetAddress() object.Set("address", addr.Hex()) object.Set("nameHash", nameHash) + object.Set("publicKey", hex.EncodeToString(crypto.FromECDSAPub(ui.GetAccount().GetUserAccountInfo().GetPublicKey()))) object.Set("sessionId", ui.GetSessionId()) resolve.Invoke(object) @@ -343,6 +347,7 @@ func walletLogin(_ js.Value, funcArgs []js.Value) interface{} { addr := ui.GetAccount().GetUserAccountInfo().GetAddress() object.Set("address", addr.Hex()) object.Set("nameHash", nameHash) + object.Set("publicKey", hex.EncodeToString(crypto.FromECDSAPub(ui.GetAccount().GetUserAccountInfo().GetPublicKey()))) object.Set("sessionId", ui.GetSessionId()) resolve.Invoke(object) }() @@ -380,6 +385,7 @@ func signatureLogin(_ js.Value, funcArgs []js.Value) interface{} { object := js.Global().Get("Object").New() object.Set("user", ui.GetUserName()) object.Set("address", lr.Address) + object.Set("publicKey", lr.PublicKey) object.Set("sessionId", ui.GetSessionId()) resolve.Invoke(object) }()