git ssb

16+

Dominic / patchbay



Commit 85234427043c9af0029e4c1e29b958c46b9b09a3

Merge branch 'invite'

Dominic Tarr committed on 7/25/2016, 5:14:33 AM
Parent: 39f86e245f88acf014f1562d3fbf1689962934f6
Parent: c03c52a611ab44283a3f77f00f78a12276bc0a21

Files changed

modules/invite.jschanged
package.jsonchanged
style.csschanged
modules/invite.jsView
@@ -9,61 +9,69 @@
99 var plugs = require('../plugs')
1010 var sbot_publish = plugs.first(exports.sbot_publish = [])
1111
1212
13-
14-exports.screen_view = function (invite) {
15-
16- //check that invite is
17- // ws:...~shs:key:seed
18-
13+//check that invite is
14+// ws:...~shs:key:seed
15+function parseMultiServerInvite (invite) {
1916 var parts = invite.split('~')
2017 .map(function (e) { return e.split(':') })
2118
2219 if(parts.length !== 2) return null
2320 if(!/^(net|wss?)$/.test(parts[0][0])) return null
2421 if(parts[1][0] !== 'shs') return null
2522 if(parts[1].length !== 3) return null
23+ var p2 = invite.split(':')
24+ p2.pop()
2625
26+ return {
27+ invite: invite,
28+ remote: p2.join(':'),
29+ }
30+}
31+
32+exports.screen_view = function (invite) {
33+
34+ var data = parseMultiServerInvite(invite)
35+ if(!data) return
36+
2737 var progress = Progress(4)
2838
2939 //connect to server
3040 //request follow
3141 //post pub announce
3242 //post follow pub
33- var div = h('div',
34- progress,
35- h('a', 'accept', {href: '#', onclick: function (ev) {
36- ev.preventDefault()
37- ev.stopPropagation()
38- attempt()
39- return false
40- }})
43+ var div = h('div.column',
44+ h('div',
45+ "invite to:", h('br'),
46+ h('code', invite),
47+ h('button', 'accept', {onclick: function (ev) {
48+ attempt()
49+ }})
50+ ),
51+ progress
4152 )
4253
4354 function attempt () {
44- progress.next('connecting...')
55+ progress.reset().next('connecting...')
56+
4557 ssbClient(null, {
4658 remote: invite,
4759 manifest: { invite: {use: 'async'}, getAddress: 'async' }
4860 }, function (err, sbot) {
4961 if(err) return progress.fail(err)
50- else progress.next('requesting follow...')
62+ progress.next('requesting follow...')
5163
5264 sbot.invite.use({feed: id}, function (err, msg) {
53- if(err) return progres.fail(err)
65+ if(err) return progress.fail(err)
66+ progress.next('following...')
5467
55- progress.next('following...')
56-
5768 //remove the seed from the shs address.
5869 //then it's correct address.
5970 //this should make the browser connect to this as remote.
6071 //we don't want to do this if when using this locally, though.
61- if(process.title === 'browser') {
62- var p2 = invite.split(':')
63- p2.pop()
64- localStorage.remote = p2.join(':')
65- }
72+ if(process.title === 'browser')
73+ localStorage.remote = data.remote
6674
6775 sbot_publish({
6876 type: 'contact',
6977 contact: sbot.id,
@@ -79,5 +87,4 @@
7987
8088 return div
8189 }
8290
83-
package.jsonView
@@ -13,9 +13,9 @@
1313 "depject": "^1.0.1",
1414 "hypercrop": "^1.0.1",
1515 "hyperfile": "^1.1.0",
1616 "hyperlightbox": "^0.1.1",
17- "hyperprogress": "0.0.0",
17+ "hyperprogress": "0.1.0",
1818 "hyperscript": "^1.4.7",
1919 "hypertabs": "^1.2.0",
2020 "mime-types": "^2.1.11",
2121 "moment": "^2.13.0",
style.cssView
@@ -285,10 +285,10 @@
285285 .hypercrop__canvas {
286286 width: 100%;
287287 }
288288
289+/* gitssb */
289290
290-
291291 .git-table-wrapper {
292292 max-height: 12em;
293293 overflow: auto;
294294 word-break: break-all;
@@ -298,5 +298,14 @@
298298 .git-table-wrapper table {
299299 width: 100%;
300300 }
301301
302+/* invite codes */
302303
304+.hyperprogress__liquid {
305+ height: 1px;
306+ background: blue;
307+}
308+
309+
310+
311+

Built with git-ssb-web