git ssb

3+

ev / sdash



Commit f0fff9a29fab4fc4f8a3ea2b1841500f34bc9175

combine invite into sdash for one server

Ev Bogue committed on 12/31/2016, 4:34:37 PM
Parent: 9c55bfe9756f66db6349ef96874c993dd8dd1466

Files changed

index.jschanged
invite.jsdeleted
index.jsView
@@ -8,8 +8,12 @@
88 var title = 'sdash'
99 var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'
1010 var viewerUrl = 'https://viewer.evbogue.com/'
1111
12 +var liteURL = 'http://ssb.evbogue.com/'
13 +var opts = {"modern":true,}
14 +var lite;
15 +
1216 http.createServer(function (req, res){
1317 if (req.url === '/') {
1418 client(function (err, sbot) {
1519 pull(
@@ -34,5 +38,28 @@
3438 )
3539 ).outerHTML)
3640 }
3741 }
42 + if (req.url === '/invite') {
43 +client(function (err, sbot) {
44 + sbot.invite.create(opts, function (err, invite) {
45 + if(err) throw err
46 + lite = invite
47 + gotInvite()
48 + })
49 + })
50 + function gotInvite() {
51 + res.end(
52 + h('html',
53 + h('head',
54 + h('title', title),
55 + h('style', fs.readFileSync('style.css', 'utf8'))
56 + ),
57 + h('body',
58 + h('div.msg',
59 + h('p', {innerHTML: '<a href="' + liteURL + '#' + lite + '">'+ liteURL + '#' + lite + '</a>'})
60 + )
61 + )
62 + ).outerHTML)
63 + }
64 + }
3865 }).listen(1337)
invite.jsView
@@ -1,37 +1,0 @@
1-var fs = require('fs')
2-var http = require('http')
3-var h = require('hyperscript')
4-var pull = require('pull-stream')
5-var client = require('ssb-client')
6-var mo = require('moment')
7-
8-var title = 'ssb-genvite'
9-var liteURL = 'http://ssb.evbogue.com/'
10-var opts = {"modern":true,}
11-var lite;
12-
13-http.createServer(function (req, res){
14- if (req.url === '/') {
15- client(function (err, sbot) {
16- sbot.invite.create(opts, function (err, invite) {
17- if(err) throw err
18- lite = invite
19- gotInvite()
20- })
21- })
22- function gotInvite() {
23- res.end(
24- h('html',
25- h('head',
26- h('title', title),
27- h('style', fs.readFileSync('style.css', 'utf8'))
28- ),
29- h('body',
30- h('div.msg',
31- h('p', {innerHTML: '<a href="' + liteURL + '#' + lite + '">'+ liteURL + '#' + lite + '</a>'})
32- )
33- )
34- ).outerHTML)
35- }
36- }
37-}).listen(1777)

Built with git-ssb-web