Skip to content

Commit 9ae154f

Browse files
committed
Applied patch by @cel-desktop
%olZBZSgTcy9C+Thnil2diY1diZfcLNIVdWZupFcBOjA=.sha256
1 parent 6cbea61 commit 9ae154f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

host/host-script.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,33 @@ const serverStream = server.createStream(onClose)
108108
109109
pull(fromWebExt, serverStream, toWebExt)*/
110110

111+
function asyncifyManifest(manifest) {
112+
if (typeof manifest !== 'object' || manifest === null) return manifest
113+
let asyncified = {}
114+
for (let k in manifest) {
115+
var value = manifest[k]
116+
// Rewrite re-exported sync methods as async,
117+
// except for manifest method, as we define it later
118+
if (value === 'sync' && k !== 'manifest') {
119+
value = 'async'
120+
}
121+
asyncified[k] = value
122+
}
123+
return asyncified
124+
}
125+
111126
Client((err, sbot) => {
112127
if (err) {
113128
console.error("could not connect to ssb-server instance", err)
114129
return
115130
}
116131
sbot.manifest().then(manifest => {
117132
//console.error('manifest', inspect(manifest))
133+
const asyncManifest = asyncifyManifest(manifest)
118134
sbot.manifest = function () {
119135
return manifest
120136
}
121-
const server = MRPC(null, manifest) (sbot)
137+
const server = MRPC(null, asyncManifest) (sbot)
122138
const serverStream = server.createStream(onClose)
123139

124140
pull(fromWebExt, serverStream, toWebExt)

0 commit comments

Comments
 (0)