This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,18 @@ module.exports = function libp2p (self) {
14
14
return callback ( err )
15
15
}
16
16
17
+ let modules = self . _options . libp2p && self . _options . libp2p . modules
18
+ ? self . _options . libp2p . modules
19
+ : undefined
20
+ // TODO fix: the self._options.libp2p.modules is being messed up
21
+ console . log ( '2 =>:' , modules )
22
+
17
23
const options = {
18
24
mdns : get ( config , 'Discovery.MDNS.Enabled' ) ,
19
25
webRTCStar : get ( config , 'Discovery.webRTCStar.Enabled' ) ,
20
26
bootstrap : get ( config , 'Bootstrap' ) ,
21
27
dht : get ( self . _options , 'EXPERIMENTAL.dht' ) ,
22
- modules : get ( self . _options , 'libp2p. modules' )
28
+ modules : modules
23
29
}
24
30
25
31
self . _libp2pNode = new Node ( self . _peerInfo , self . _peerInfoBook , options )
Original file line number Diff line number Diff line change @@ -32,18 +32,18 @@ function HttpApi (repo, config) {
32
32
33
33
series ( [
34
34
( cb ) => {
35
- const libp2p = {
36
- modules : { }
37
- }
35
+ const libp2p = { modules : { } }
38
36
39
37
// Attempt to use any of the WebRTC versions available globally
40
38
let electronWebRTC
41
39
let wrtc
42
40
try { electronWebRTC = require ( 'electron-webrtc' ) ( ) } catch ( err ) { }
43
41
try { wrtc = require ( 'wrtc' ) } catch ( err ) { }
44
42
45
- if ( electronWebRTC || wrtc ) {
46
- const wstar = new WStar ( electronWebRTC || wrtc )
43
+ console . log ( ! ! wrtc , ! ! electronWebRTC )
44
+ if ( wrtc || electronWebRTC ) {
45
+ const wstar = new WStar ( { wrtc : ( wrtc || electronWebRTC ) } )
46
+ console . log ( '1 =>:' , wstar )
47
47
libp2p . modules . transport = [ wstar ]
48
48
libp2p . modules . discovery = [ wstar . discovery ]
49
49
}
@@ -59,7 +59,8 @@ function HttpApi (repo, config) {
59
59
EXPERIMENTAL : {
60
60
pubsub : true ,
61
61
sharding : config && config . enableShardingExperiment
62
- }
62
+ } ,
63
+ libp2p : libp2p
63
64
} )
64
65
} catch ( err ) {
65
66
return cb ( err )
You can’t perform that action at this time.
0 commit comments