git ssb

16+

Dominic / patchbay



Tree: af7e4129360b36c2646ff7a736b53c73d5709ee6

Files: af7e4129360b36c2646ff7a736b53c73d5709ee6 / main.js

1830 bytesRaw
1const combine = require('depject')
2const entry = require('depject/entry')
3const nest = require('depnest')
4const bulk = require('bulk-require')
5
6// polyfills
7require('setimmediate')
8
9const patchbay = {
10 patchbay: {
11 about: bulk(__dirname, [ 'about/**/*.js' ]),
12 app: bulk(__dirname, [ 'app/**/*.js' ]),
13 blob: bulk(__dirname, [ 'blob/**/*.js' ]),
14 channel: bulk(__dirname, [ 'channel/**/*.js' ]),
15 contact: bulk(__dirname, [ 'contact/**/*.js' ]),
16 message: bulk(__dirname, [ 'message/**/*.js' ]),
17 router: bulk(__dirname, [ 'router/**/*.js' ]),
18 styles: bulk(__dirname, [ 'styles/**/*.js' ]),
19 sbot: bulk(__dirname, [ 'sbot/**/*.js' ]),
20
21 config: require('./config'), // shouldn't be in here ?
22 contextMenu: require('patch-context'),
23 suggestions: require('patch-suggest'),
24 settings: require('patch-settings'),
25 drafts: require('patch-drafts'),
26 inbox: require('patch-inbox'), // TODO - ideally this would be a standalone patch-* module
27 history: require('patch-history')
28 }
29}
30
31const post = {
32 patchbay: {
33 message: bulk(__dirname, [ 'post-patchcore/message/**/*.js' ])
34 }
35}
36
37// from more specialized to more general
38const sockets = combine(
39 require('ssb-horcrux'),
40
41 require('patchbay-dark-crystal'),
42 require('patchbay-poll'),
43 require('ssb-chess'),
44 require('patchbay-gatherings'),
45 require('patchbay-book'),
46 patchbay,
47 require('patchcore'),
48 post
49)
50
51// remove patchcore reply for our version
52var pcReplyIndex = sockets.message.html.action.findIndex(x => x.name === 'reply')
53if (pcReplyIndex !== -1) { delete sockets.message.html.action[pcReplyIndex] }
54
55const api = entry(sockets, nest('app.html.app', 'first'))
56const app = api.app.html.app
57
58module.exports = patchbay
59
60// for electro[n]
61if (typeof window !== 'undefined') {
62 document.body.appendChild(app())
63}
64

Built with git-ssb-web