Merge pull request #218 from christianbundy/fix-like

Fix likes not working with Patchwork as server
This commit is contained in:
Jonathan Dahan 2020-02-17 11:43:48 -05:00 committed by GitHub
commit 5b37240067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 11 deletions

View File

@ -4,15 +4,17 @@
"words": [ "words": [
"AGPL", "AGPL",
"Argyris", "Argyris",
"backlinks",
"christianbundy",
"dogfood",
"Hintjens", "Hintjens",
"hyperaxe",
"hyperscript",
"Kata", "Kata",
"LGPL", "LGPL",
"Machinekit", "Machinekit",
"OSSEC",
"Pieter",
"backlinks",
"christianbundy",
"dogfood",
"hyperaxe",
"hyperscript",
"manyverse", "manyverse",
"minlength", "minlength",
"monokai", "monokai",
@ -21,16 +23,16 @@
"muxrpc", "muxrpc",
"nanohtml", "nanohtml",
"nosniff", "nosniff",
"OSSEC",
"paramap", "paramap",
"patchbay", "patchbay",
"patchfoo", "patchfoo",
"patchfox", "patchfox",
"Pieter", "promisify",
"rebecca", "rebecca",
"recps", "recps",
"roadmap", "roadmap",
"sameorigin", "sameorigin",
"sbot",
"shortname", "shortname",
"socio", "socio",
"ssbc", "ssbc",

View File

@ -4,6 +4,7 @@
// to call methods over MuxRPC. It's a thin wrapper around SSB-Client, which is // to call methods over MuxRPC. It's a thin wrapper around SSB-Client, which is
// a thin wrapper around the MuxRPC module. // a thin wrapper around the MuxRPC module.
const { promisify } = require("util");
const ssbClient = require("ssb-client"); const ssbClient = require("ssb-client");
const ssbConfig = require("ssb-config"); const ssbConfig = require("ssb-config");
const flotilla = require("@fraction/flotilla"); const flotilla = require("@fraction/flotilla");
@ -30,6 +31,9 @@ const rawConnect = () =>
// //
// See: https://github.com/fraction/oasis/issues/21 // See: https://github.com/fraction/oasis/issues/21
api.tangle = ssbTangle.init(api); api.tangle = ssbTangle.init(api);
// MuxRPC supports promises but the raw plugin does not.
api.tangle.branch = promisify(api.tangle.branch);
} }
resolve(api); resolve(api);
@ -46,7 +50,10 @@ const createConnection = config => {
log("Using pre-existing Scuttlebutt server instead of starting one"); log("Using pre-existing Scuttlebutt server instead of starting one");
resolve(ssb); resolve(ssb);
}) })
.catch(() => { .catch(e => {
if (e.message !== "could not connect to sbot") {
throw e;
}
log("Initial connection attempt failed"); log("Initial connection attempt failed");
log("Starting Scuttlebutt server"); log("Starting Scuttlebutt server");
server(config); server(config);
@ -80,9 +87,6 @@ module.exports = ({ offline }) => {
const config = { const config = {
conn: { conn: {
autostart: !offline autostart: !offline
},
ws: {
http: false
} }
}; };