Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ matrix:

cache:
directories:
- $HOME/.npm
- $HOME/.cache/electron
- $HOME/.cache/electron-builder

Expand All @@ -34,6 +33,7 @@ before_install:
libxkbfile-dev \
libxtst-dev
fi
- npm cache verify

script: npm test && npm run dist

Expand Down
11 changes: 3 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,6 @@ function setupContext (appName, opts, cb) {
dunbar: 150,
hops: 2 // down from 3
}
// connections: { // to support DHT invites
// incoming: {
// dht: [{ scope: 'public', transform: 'shs', port: 8423 }]
// },
// outgoing: {
// dht: [{ transform: 'shs' }]
// }
// }
}, opts))

// disable gossip auto-population from {type: 'pub'} messages as we handle this manually in sbot/index.js
Expand All @@ -233,6 +225,9 @@ function setupContext (appName, opts, cb) {
ssbConfig.connections.incoming.tunnel = [{ scope: 'public', transform: 'shs' }]
ssbConfig.connections.outgoing.tunnel = [{ transform: 'shs' }]

// Support DHT invites (only as a client, for now)
ssbConfig.connections.outgoing.dht = [{ transform: 'shs' }]

const redactedConfig = JSON.parse(JSON.stringify(ssbConfig))
redactedConfig.keys.private = null
console.dir(redactedConfig, { depth: null })
Expand Down
2 changes: 0 additions & 2 deletions lib/depject/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ module.exports = {
}
},
invite: {
dhtAcceptSheet: require('./invite/dhtAcceptSheet.js'),
dhtCreateSheet: require('./invite/dhtCreateSheet.js'),
invite: require('./invite/invite.js'),
sheet: require('./invite/sheet.js')
},
Expand Down
76 changes: 0 additions & 76 deletions lib/depject/invite/dhtAcceptSheet.js

This file was deleted.

77 changes: 0 additions & 77 deletions lib/depject/invite/dhtCreateSheet.js

This file was deleted.

5 changes: 5 additions & 0 deletions lib/depject/invite/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const nest = require('depnest')
exports.needs = nest({
'sbot.async.publish': 'first',
'sbot.async.connRememberConnect': 'first',
'sbot.async.acceptDHT': 'first',
'contact.async.followerOf': 'first',
'keys.sync.id': 'first',
'config.sync.load': 'first'
Expand All @@ -27,6 +28,10 @@ exports.create = function (api) {
api.sbot.async.connRememberConnect(address, { type: 'room' }, cb)
return
}
if (invite.startsWith('dht:')) {
api.sbot.async.acceptDHT(invite, () => {})
return cb(null, true)
}

const data = ref.parseInvite(invite)
const id = api.keys.sync.id()
Expand Down
13 changes: 0 additions & 13 deletions lib/depject/page/html/render/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ exports.needs = nest({
'about.html.image': 'first',
'about.obs.name': 'first',
'invite.sheet': 'first',
'dhtInvite.accept.sheet': 'first',
'dhtInvite.create.sheet': 'first',

'message.html.compose': 'first',
'message.async.publish': 'first',
Expand Down Expand Up @@ -117,17 +115,6 @@ exports.create = function (api) {
'ev-click': api.invite.sheet
}, i18n('+ Join Server')),

// disabling DHT invites until they work in sbot@13
//
// h('SplitButton', [
// h('button -createInvite', {
// 'ev-click': api.dhtInvite.create.sheet
// }, i18n('Create Invite')),
// h('button -acceptInvite', {
// 'ev-click': api.dhtInvite.accept.sheet
// }, i18n('Accept Invite'))
// ]),

when(channelsLoading, [h('Loading')], [
when(computed(recentChannels, x => x.length), [
h('h2', i18n('Active Channels')),
Expand Down
6 changes: 1 addition & 5 deletions lib/depject/sbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ exports.gives = {
connConnect: true,
connRememberConnect: true,
friendsGet: true,
acceptDHT: true,
createDHT: true
acceptDHT: true
},
pull: {
log: true,
Expand Down Expand Up @@ -214,9 +213,6 @@ exports.create = function (api) {
}),
acceptDHT: rec.async(function (opts, cb) {
sbot.dhtInvite.accept(opts, cb)
}),
createDHT: rec.async(function (cb) {
sbot.dhtInvite.create(cb)
})
},
pull: {
Expand Down
21 changes: 1 addition & 20 deletions lib/server-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ const Path = require('path')
const electron = require('electron')
const spawn = require('child_process').spawn
const fixPath = require('fix-path')
// var DHT = require('multiserver-dht')

// removing DHT invites until they work in sbot@13
//
// function dhtTransport (sbot) {
// sbot.multiserver.transport({
// name: 'dht',
// create: dhtConfig => {
// return DHT({
// keys: sbot.dhtInvite.channels(),
// port: dhtConfig.por t
// })
// }
// })
// }

const createSbot = require('secret-stack')()
.use(require('ssb-db'))
Expand All @@ -34,8 +19,7 @@ const createSbot = require('secret-stack')()
.use(require('ssb-about'))
.use(require('ssb-private'))
.use(require('ssb-room/tunnel/client'))
// .use(require('ssb-dht-invite')) // this one must come before dhtTransport
// .use(dhtTransport)
.use(require('ssb-dht-invite'))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wondered why the chaining order is like it is here as it is not arbitrary, right? It would be really great to add some documentation about that here at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not arbitrary, but it's also not documented. To be candid, I think the SecretStack plugin system is an anti-pattern that encourages global mutable state. I'm doing my best to randomize the plugin order in Oasis with this pattern (https://github.com/fraction/flotilla/blob/master/index.js) but it's still a mess. I really wish these modules would just require() their dependencies instead of using another dependency system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be candid, I think the SecretStack plugin system is an anti-pattern that encourages global mutable state.

😱 hot take! I actually like the secret-stack plugin system, out of all the other ideas in the SSB stack.

Copy link
Member Author

@staltz staltz Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If y'all want some insight on what depends on what, I wrote it down for Manyverse here:

https://github.com/staltz/manyverse/blob/3a4e80d151fe70cbd7d9fcfe133b1eec863aef14/src/backend/ssb.ts#L57-L94

.use(require('ssb-invite'))
.use(require('ssb-query'))
.use(require('ssb-search'))
Expand All @@ -55,9 +39,6 @@ module.exports = function (ssbConfig) {
fs.writeFileSync(Path.join(ssbConfig.path, 'manifest.json'), JSON.stringify(ssbConfig.manifest))
electron.ipcRenderer.send('server-started', ssbConfig)

// start dht invite support
// context.sbot.dhtInvite.start()

// check if we are using a custom ssb path (which would break git-ssb-web)
if (!ssbConfig.customPath) {
// attempt to run git-ssb if it is installed and in path
Expand Down
Loading