Commit 093c66d7a4531f2454c5d785da9a9f7d9d824976
update lite client import/export to support depject2
Ev Bogue committed on 12/9/2016, 4:51:09 PMParent: 361edfb357cbe49eea70e6d6e454d54ccff33532
Files changed
modules_extra/index.js | changed |
modules_extra/key.js | added |
modules_extra/index.js | ||
---|---|---|
@@ -5,8 +5,9 @@ | ||
5 | 5 … | "suggest-emoji.js": require('./suggest-emoji.js'), |
6 | 6 … | "dns.js": require('./dns.js'), |
7 | 7 … | "git.js": require('./git.js'), |
8 | 8 … | "git-ssb.js": require('./git-ssb.js'), |
9 … | + "key.js": require('./key.js'), | |
9 | 10 … | "notifications.js": require('./notifications.js'), |
10 | 11 … | "meta-image.js": require('./meta-image.js'), |
11 | 12 … | "music-release-cc.js": require('./music-release-cc.js'), |
12 | 13 … | "music-release.js": require('./music-release.js'), |
modules_extra/key.js | ||
---|---|---|
@@ -1,0 +1,62 @@ | ||
1 … | +var h = require('hyperscript') | |
2 … | +var u = require('../util') | |
3 … | +var pull = require('pull-stream') | |
4 … | +var Scroller = require('pull-scroll') | |
5 … | + | |
6 … | +//var plugs = require('../plugs') | |
7 … | +// var message_render = plugs.first(exports.message_render = []) | |
8 … | +// var message_compose = plugs.first(exports.message_compose = []) | |
9 … | +// var sbot_log = plugs.first(exports.sbot_log = []) | |
10 … | + | |
11 … | + | |
12 … | +exports.gives = { | |
13 … | + menu_items: true, screen_view: true | |
14 … | +} | |
15 … | + | |
16 … | +exports.create = function (api) { | |
17 … | + return { | |
18 … | + menu_items: function () { | |
19 … | + return h('a', {href: '#/key'}, '/key') | |
20 … | + }, | |
21 … | + screen_view: function (path, sbot) { | |
22 … | + if(path === '/key') { | |
23 … | + if(process.title === 'browser') { | |
24 … | + var importKey = h('textarea', {placeholder: 'import an existing public/private key', name: 'textarea'}) | |
25 … | + var importRemote = h('textarea', {placeholder: 'import an existing remote', name: 'textarea'}) | |
26 … | + var content = h('div.column.scroller__content') | |
27 … | + var div = h('div.column.scroller', | |
28 … | + {style: {'overflow':'auto'}}, | |
29 … | + h('div.scroller__wrapper', | |
30 … | + h('div.column.scroller__content', | |
31 … | + h('div.message', | |
32 … | + h('p', {innerHTML: 'Your secret key is: <pre><code>' + localStorage['browser/.ssb/secret'] + '</code></pre>'}), | |
33 … | + h('form', | |
34 … | + importKey, | |
35 … | + h('button', {onclick: function (e){ | |
36 … | + localStorage['browser/.ssb/secret'] = importKey.value.replace(/\s+/g, ' ') | |
37 … | + alert('Your public/private key has been updated') | |
38 … | + e.preventDefault() | |
39 … | + }}, 'Import'), | |
40 … | + h('p', {innerHTML: 'Your ws remote is: <pre>' + localStorage.remote + '</pre>'}), | |
41 … | + h('form', | |
42 … | + importRemote, | |
43 … | + h('button', {onclick: function (e){ | |
44 … | + localStorage.remote = importRemote.value | |
45 … | + alert('Your websocket remote has been updated') | |
46 … | + e.preventDefault() | |
47 … | + }}, 'Import') | |
48 … | + ) | |
49 … | + ) | |
50 … | + ) | |
51 … | + ) | |
52 … | + ) | |
53 … | + ) | |
54 … | + return div | |
55 … | + } else { | |
56 … | + return h('p', 'Your key is saved at .ssb/secret') | |
57 … | + } | |
58 … | + } | |
59 … | + } | |
60 … | + } | |
61 … | +} | |
62 … | + |
Built with git-ssb-web