git ssb

16+

Dominic / patchbay



Tree: 1d62bb3c81414c6538c54c367803bce3f2516a68

Files: 1d62bb3c81414c6538c54c367803bce3f2516a68 / modules_extra / key.js

1882 bytesRaw
1var h = require('hyperscript')
2
3exports.gives = {
4 menu_items: true,
5 screen_view: true
6}
7
8exports.create = function (api) {
9 return {
10 menu_items: function () {
11 return h('a', {href: '#/key'}, '/key')
12 },
13 screen_view: function (path, sbot) {
14 if(path === '/key') {
15 if(process.title === 'browser') {
16 var importKey = h('textarea', {placeholder: 'import an existing public/private key', name: 'textarea'})
17 var importRemote = h('textarea', {placeholder: 'import an existing remote', name: 'textarea'})
18
19 return h('div.column.scroller',
20 {style: {'overflow':'auto'}},
21 h('div.scroller__wrapper',
22 h('div.column.scroller__content',
23 h('div.message',
24 h('p', {innerHTML: 'Your secret key is: <pre><code>' + localStorage['browser/.ssb/secret'] + '</code></pre>'}),
25 h('form',
26 importKey,
27 h('button', {onclick: function (e){
28 localStorage['browser/.ssb/secret'] = importKey.value.replace(/\s+/g, ' ')
29 alert('Your public/private key has been updated')
30 e.preventDefault()
31 }}, 'Import'),
32 h('p', {innerHTML: 'Your ws remote is: <pre>' + localStorage.remote + '</pre>'}),
33 h('form',
34 importRemote,
35 h('button', {onclick: function (e){
36 localStorage.remote = importRemote.value
37 alert('Your websocket remote has been updated')
38 e.preventDefault()
39 }}, 'Import')
40 )
41 )
42 )
43 )
44 )
45 )
46 } else {
47 return h('p', 'Your key is saved at .ssb/secret')
48 }
49 }
50 }
51 }
52}
53
54

Built with git-ssb-web