git ssb

2+

mixmix / ticktack



Tree: 4f3123cd652a5603873f1d2e87d6016552e7b4c8

Files: 4f3123cd652a5603873f1d2e87d6016552e7b4c8 / main.js

1822 bytesRaw
1const combine = require('depject')
2const entry = require('depject/entry')
3const nest = require('depnest')
4
5// polyfills
6require('setimmediate')
7
8// add inspect right click menu
9require('./context-menu')
10
11// from more specialized to more general
12const sockets = combine(
13 //need some modules first
14 {
15 settings: require('patch-settings'),
16 translations: require('./translations/sync'),
17 suggestions: require('patch-suggest'), // so that styles can be over-ridden
18 },
19 {
20 about: require('./about'),
21 app: require('./app'),
22 blob: require('./blob'),
23 contact: require('./contact'),
24 //config: require('./ssb-config'),
25 config: require('./config'),
26 // group: require('./group'),
27 message: require('./message'),
28 router: require('./router'),
29 styles: require('./styles'),
30 state: require('./state/obs'),
31 unread: require('./unread'),
32 },
33 {
34 profile: require('patch-profile'),
35 history: require('patch-history'),
36 core: require('patchcore')
37 }
38)
39
40const api = entry(sockets, nest({
41 'app.html.app': 'first',
42 'invite.async.autofollow': 'first',
43 'config.sync.load': 'first',
44 'sbot.async.friendsGet': 'first',
45 'sbot.async.get': 'first'
46}))
47
48document.body.appendChild(api.app.html.app())
49// console.log(api.config.sync.load())
50
51var invite = api.config.sync.load().autoinvite
52var self_id = api.config.sync.load().keys.id
53if(invite) {
54 api.sbot.async.friendsGet({dest: self_id}, function (err, friends) {
55 //if you have less than 5 followers, maybe use the autoinvite
56 if(Object.keys(friends).length <= 5)
57 api.invite.async.autofollow(
58 invite,
59 function (err, follows) { console.log('autofollowed', err, follows) }
60 )
61 else
62 console.log('no autoinvite - you have friends already')
63 })
64}
65else
66 console.log('no invite')
67
68
69

Built with git-ssb-web