Skip to content

Commit 66b719e

Browse files
authored
Merge pull request #453 from fairDataSociety/0.9.3-rc2
disable sub manager
2 parents eb37107 + 8b03007 commit 66b719e

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

cmd/dfs/cmd/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ can consume it.`,
206206

207207
ctx, cancel := context.WithCancel(cmd.Context())
208208
defer cancel()
209-
// datadir will be removed in some future version. it is kept for migration purpose only
210-
hdlr, err := api.New(ctx, beeApi, cookieDomain, postageBlockId, corsOrigins, ensConfig, subscriptionConfig, logger)
209+
210+
hdlr, err := api.New(ctx, beeApi, cookieDomain, postageBlockId, corsOrigins, ensConfig, nil, logger)
211211
if err != nil {
212212
logger.Error(err.Error())
213213
return err

pkg/contracts/config.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ func TestnetConfig() (*ENSConfig, *SubscriptionConfig) {
2525
PublicResolverAddress: "0xbfeCC6c32B224F7D0026ac86506Fe40A9607BD14",
2626
ProviderDomain: "fds",
2727
}
28-
29-
s := &SubscriptionConfig{
30-
DataHubAddress: "0xBE41b272e3cDe3aeC8fE4a144C5b7cE71D9e6498",
31-
}
32-
return e, s
28+
return e, nil
3329
}
3430

3531
// PlayConfig defines the configuration for fdp-play

pkg/dfs/pod_api.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,23 @@ func (a *API) GetSubscribablePodInfo(sessionId string, subHash [32]byte) (*rpc.S
687687
if ui == nil {
688688
return nil, ErrUserNotLoggedIn
689689
}
690-
690+
if a.sm == nil {
691+
return nil, errNilSubManager
692+
}
691693
return a.sm.GetSubscribablePodInfo(subHash)
692694
}
693695

694696
// OpenSubscribedPod
695697
func (a *API) OpenSubscribedPod(sessionId string, subHash [32]byte, infoLocation string) (*pod.Info, error) {
698+
// get the loggedin user information
699+
ui := a.users.GetLoggedInUserInfo(sessionId)
700+
if ui == nil {
701+
return nil, ErrUserNotLoggedIn
702+
}
696703

704+
if a.sm == nil {
705+
return nil, errNilSubManager
706+
}
697707
sub, err := a.sm.GetSub(subHash)
698708
if err != nil {
699709
return nil, err
@@ -706,12 +716,6 @@ func (a *API) OpenSubscribedPod(sessionId string, subHash [32]byte, infoLocation
706716
return nil, err
707717
}
708718

709-
// get the loggedin user information
710-
ui := a.users.GetLoggedInUserInfo(sessionId)
711-
if ui == nil {
712-
return nil, ErrUserNotLoggedIn
713-
}
714-
715719
// open the pod
716720
pi, err := ui.GetPod().OpenSubscribedPodFromReference(infoLocation, ownerPublicKey)
717721
if err != nil {
@@ -733,7 +737,9 @@ func (a *API) GetSubscribablePods(sessionId string) ([]datahub.DataHubSub, error
733737
if ui == nil {
734738
return nil, ErrUserNotLoggedIn
735739
}
736-
740+
if a.sm == nil {
741+
return nil, errNilSubManager
742+
}
737743
return ui.GetPod().GetMarketplace()
738744
}
739745

@@ -744,6 +750,8 @@ func (a *API) GetSubsRequests(sessionId string) ([]datahub.DataHubSubRequest, er
744750
if ui == nil {
745751
return nil, ErrUserNotLoggedIn
746752
}
747-
753+
if a.sm == nil {
754+
return nil, errNilSubManager
755+
}
748756
return ui.GetPod().GetSubRequests()
749757
}

wasm/main.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,37 +113,30 @@ func connect(_ js.Value, funcArgs []js.Value) interface{} {
113113
handler := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
114114
resolve := args[0]
115115
reject := args[1]
116-
if len(funcArgs) != 6 {
117-
reject.Invoke("not enough arguments. \"connect(beeEndpoint, stampId, rpc, network, subRpc, subContractAddress)\"")
116+
if len(funcArgs) != 4 {
117+
reject.Invoke("not enough arguments. \"connect(beeEndpoint, stampId, rpc, network)\"")
118118
return nil
119119
}
120120
beeEndpoint := funcArgs[0].String()
121121
stampId := funcArgs[1].String()
122122
rpc := funcArgs[2].String()
123123
network := funcArgs[3].String()
124-
subRpc := funcArgs[4].String()
125-
subContractAddress := funcArgs[5].String()
124+
//subRpc := funcArgs[4].String()
125+
//subContractAddress := funcArgs[5].String()
126126
if network != "testnet" && network != "play" {
127127
reject.Invoke("unknown network. \"use play or testnet\"")
128128
return nil
129129
}
130130
var (
131-
config *contracts.ENSConfig
132-
subConfig *contracts.SubscriptionConfig
131+
config *contracts.ENSConfig
133132
)
134133

135134
if network == "play" {
136-
config, subConfig = contracts.PlayConfig()
135+
config, _ = contracts.PlayConfig()
137136
} else {
138-
config, subConfig = contracts.TestnetConfig()
137+
config, _ = contracts.TestnetConfig()
139138
}
140139
config.ProviderBackend = rpc
141-
if subRpc != "" {
142-
subConfig.RPC = subRpc
143-
}
144-
if subContractAddress != "" {
145-
subConfig.DataHubAddress = subContractAddress
146-
}
147140
logger := logging.New(os.Stdout, logrus.DebugLevel)
148141

149142
go func() {
@@ -152,7 +145,7 @@ func connect(_ js.Value, funcArgs []js.Value) interface{} {
152145
beeEndpoint,
153146
stampId,
154147
config,
155-
subConfig,
148+
nil,
156149
logger,
157150
)
158151
if err != nil {

0 commit comments

Comments
 (0)