git ssb

16+

Dominic / patchbay



Tree: 0831215dc5165e22aefa788b8249903f50b9de23

Files: 0831215dc5165e22aefa788b8249903f50b9de23 / modules_extra / key.js

2281 bytesRaw
1var h = require('hyperscript')
2var u = require('../util')
3var pull = require('pull-stream')
4var 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
12exports.gives = {
13 menu_items: true, screen_view: true
14}
15
16exports.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
63

Built with git-ssb-web