Files: afe7de9580840925af61711b5ab0d6c57d1131a4 / modules / identify.js
1716 bytesRaw
1 | var h = require('hyperscript') |
2 | var u = require('../util') |
3 | var pull = require('pull-stream') |
4 | var Scroller = require('pull-scroll') |
5 | var id = require('../keys').id |
6 | |
7 | exports.needs = { |
8 | publish: 'first' |
9 | } |
10 | |
11 | exports.gives = { |
12 | screen_view: true |
13 | } |
14 | |
15 | exports.create = function (api) { |
16 | return { |
17 | screen_view: function (path, sbot) { |
18 | if(path === 'Identify') { |
19 | if(process.title === 'browser') { |
20 | var identify = h('input.identify', {placeholder: 'Your Name', name: 'namespace'}) |
21 | var div = h('div.scroller__wrapper', |
22 | h('div.column.scroller__content', {style: 'margin-top: 25%;'}, |
23 | h('h1', 'You\'re in! Now, you need a name'), |
24 | h('p', {innerHTML: '<p>You\'ve just generated a new public/private keypair: <pre><code>' + localStorage['browser/.ssb/secret'] + '</code></pre> You\'re the only person with access to the private key. If you want to hang onto this identity, save this key somewhere safe.<hr />'}), |
25 | h('p', {innerHTML: 'Right now, you\'re only identified by your public key: <code>' + id + '</code></p><p>Start by giving yourself a name:'}, |
26 | h('form', |
27 | identify, |
28 | h('button', 'Save', {onclick: function (e) { |
29 | if(identify.value) |
30 | api.publish({ |
31 | type: 'about', |
32 | about: id, |
33 | name: identify.value || undefined, |
34 | }, |
35 | location.hash = '' |
36 | ), |
37 | e.preventDefault() |
38 | }}) |
39 | ) |
40 | ) |
41 | ) |
42 | ) |
43 | return div |
44 | } |
45 | } |
46 | } |
47 | } |
48 | } |
49 | |
50 |
Built with git-ssb-web