Files: 746f5afe179f874dc5f6c5608629c805307ecf1c / invite.js
912 bytesRaw
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) |
38 |
Built with git-ssb-web