git ssb

16+

Dominic / patchbay



Commit 9e65f9951f21778ee286834004367aa2b46bc882

use ssb-ref instead of inlining parsing methods

Dominic Tarr committed on 10/30/2016, 2:49:16 PM
Parent: 1ef97e17613609ee9b636be098a17a17798f7d58

Files changed

modules/invite.jschanged
modules/setup.jschanged
modules/invite.jsView
@@ -9,35 +9,10 @@
99 var plugs = require('../plugs')
1010 var sbot_publish = plugs.first(exports.sbot_publish = [])
1111 var follower_of = plugs.first(exports.follower_of = [])
1212
13-
14-//check that invite is
15-// ws:...~shs:key:seed
16-function parseMultiServerInvite (invite) {
17- var redirect = invite.split('#')
18- if(!redirect.length) return null
19-
20- var parts = redirect[0].split('~')
21- .map(function (e) { return e.split(':') })
22-
23- if(parts.length !== 2) return null
24- if(!/^(net|wss?)$/.test(parts[0][0])) return null
25- if(parts[1][0] !== 'shs') return null
26- if(parts[1].length !== 3) return null
27- var p2 = invite.split(':')
28- p2.pop()
29-
30- return {
31- invite: redirect[0],
32- remote: p2.join(':'),
33- key: '@'+parts[1][1]+'.ed25519',
34- redirect: '#' + redirect.slice(1).join('#')
35- }
36-}
37-
3813 exports.invite_parse = function (invite) {
39- return parseMultiServerInvite(invite)
14 + return ref.parseInvite(invite)
4015 }
4116
4217 exports.invite_accept = function (invite, onProgress, cb) {
4318 var data = exports.invite_parse(invite)
@@ -82,9 +57,9 @@
8257 }
8358
8459 exports.screen_view = function (invite) {
8560
86- var data = parseMultiServerInvite(invite)
61 + var data = ref.parseInvite(invite)
8762 if(!data) return
8863
8964 var progress = Progress(4)
9065
@@ -125,4 +100,7 @@
125100
126101 return div
127102 }
128103
104 +
105 +
106 +
modules/setup.jsView
@@ -44,9 +44,9 @@
4444 invite_accept(input.value, function (msg) {
4545 status.textContent = msg
4646 }, function (err) {
4747 if(err) {
48- accept.textContent = 'error:'+err.message
48 + accept.textContent = 'error:'+(err.message || err.stack || error.type)
4949 console.error(err)
5050 }
5151 else {
5252 input.value = ''
@@ -142,12 +142,4 @@
142142 ))
143143 }
144144
145145
146-
147-
148-
149-
150-
151-
152-
153-

Built with git-ssb-web