Browse Source

update sbot to use() phoenix-api

Paul Frazee 5 years ago
parent
commit
026de532c8
3 changed files with 10 additions and 5 deletions
  1. 5
    2
      app/index.js
  2. 4
    3
      app/lib/muxrpc-ipc.js
  3. 1
    0
      package.json

+ 5
- 2
app/index.js View File

@@ -16,7 +16,10 @@ app.on('ready', function ready () {
16 16
 
17 17
   // start sbot
18 18
   require('scuttlebot').init(config, function (err, sbot) {
19
-    // register protocols
19
+    // register sbot plugins
20
+    sbot.use(require('phoenix-api'))
21
+
22
+    // register electron protocols
20 23
     require('protocol').registerProtocol('blob', blobs.protocol)
21 24
 
22 25
     // open the web app
@@ -26,7 +29,7 @@ app.on('ready', function ready () {
26 29
       blobs,
27 30
       { width: 1000, height: 720 }
28 31
     )
29
-    mainWindow.openDevTools()
32
+    // mainWindow.openDevTools()
30 33
 
31 34
     // setup menu
32 35
     // Menu.setApplicationMenu(Menu.buildFromTemplate([{

+ 4
- 3
app/lib/muxrpc-ipc.js View File

@@ -25,9 +25,10 @@ module.exports = function (window, sbot, params) {
25 25
     if (e.sender == window.webContents)
26 26
       ipcPush.push(msg)
27 27
   })
28
-  pull(ipcPush, rpcStream, pull.drain(function (msg) {
29
-    window.webContents.send('muxrpc-ssb', msg)
30
-  }))
28
+  pull(ipcPush, rpcStream, pull.drain(
29
+    function (msg) { window.webContents.send('muxrpc-ssb', msg) },
30
+    function (err) { if (err) { console.error(err) } }
31
+  ))
31 32
 
32 33
   // setup helper messages
33 34
   ipc.on('fetch-config', function(e) {

+ 1
- 0
package.json View File

@@ -28,6 +28,7 @@
28 28
     "multiblob": "^1.4.3",
29 29
     "multicb": "^1.1.0",
30 30
     "muxrpc": "^5.0.1",
31
+    "phoenix-api": "~8.0.0",
31 32
     "pull-pushable": "^1.1.4",
32 33
     "pull-stream": "^2.27.0",
33 34
     "scuttlebot": "^4.2.3",

Loading…
Cancel
Save