Commit 3a73aa178d3d0aae49095e0befc1ae5fb2de81b4
remove invite checker
Ev Bogue committed on 2/14/2019, 1:48:05 AMParent: d6c90ba12886129623834c81dfcd6e02e6ec8d5d
Files changed
invite.js | deleted |
invite.js | ||
---|---|---|
@@ -1,73 +1,0 @@ | ||
1 | -var ref = require('ssb-ref') | |
2 | -var h = require('hyperscript') | |
3 | -var client = require('ssb-client') | |
4 | -var sbot = require('./scuttlebot') | |
5 | -var config = require('./config')() | |
6 | - | |
7 | -var keys = require('./keys') | |
8 | - | |
9 | - | |
10 | -function parseInvite (invite) { | |
11 | - return ref.parseInvite(invite) | |
12 | -} | |
13 | - | |
14 | -module.exports = function () { | |
15 | - | |
16 | - setTimeout(function () { | |
17 | - var currentScreen = document.getElementById('screen') | |
18 | - var invitebox = h('input', {placeholder: 'Invite Code Here'}) | |
19 | - invitebox.value = config.invite | |
20 | - var invite = h('div.content', h('div.message#inviter', | |
21 | - 'Hey, no one follows you. Your secure-scuttlebutt feed may not replicate unless a pub follows you. Either ', h('a', {href: '#key'}, 'import your key'), ' or use a pub invite:', | |
22 | - h('br'), | |
23 | - invitebox, | |
24 | - h('button.btn', 'Accept', {onclick: function (e) { | |
25 | - var data = parseInvite(invitebox.value) | |
26 | - e.preventDefault() | |
27 | - //sbot.gossip.connect(data.remote, function (err) { | |
28 | - | |
29 | - //}) | |
30 | - | |
31 | - client(keys, { | |
32 | - remote: data.invite, | |
33 | - caps: config.caps, | |
34 | - manifest: {invite: {use: 'async'}, getAddress: 'async'} | |
35 | - }, function (err, remotebot) { | |
36 | - if (err) throw err | |
37 | - remotebot.invite.use({feed: keys.id}, function (_err, msg) { | |
38 | - if (msg) { | |
39 | - sbot.publish({ | |
40 | - type: 'contact', | |
41 | - contact: data.key, | |
42 | - following: true | |
43 | - }) | |
44 | - } | |
45 | - }) | |
46 | - setTimeout(function () { | |
47 | - location.hash = '#' + keys.id | |
48 | - location.hash = '#' | |
49 | - }, 100) | |
50 | - }) | |
51 | - }}) | |
52 | - )) | |
53 | - if (currentScreen.firstChild.firstChild) { | |
54 | - currentScreen.firstChild.insertBefore(invite, currentScreen.firstChild.firstChild) | |
55 | - } else { | |
56 | - currentScreen.firstChild.appendChild(invite) | |
57 | - } | |
58 | - sbot.friends.get({dest: keys.id}, function (err, follows) { | |
59 | - for (var i in follows) { | |
60 | - if (follows[i] === true) { | |
61 | - var getInvite = document.getElementById('inviter') | |
62 | - | |
63 | - if (getInvite) { | |
64 | - getInvite.parentNode.removeChild(getInvite) | |
65 | - } | |
66 | - } | |
67 | - } | |
68 | - }) | |
69 | - | |
70 | - | |
71 | - }, 1000) | |
72 | - | |
73 | -} |
Built with git-ssb-web