Commit 9bbc62058751f1840e64c1f4b83eb09573dd4e2a
save remote in a unique place, so it's easier to switch between networks
Ev Bogue committed on 12/28/2017, 8:12:35 PMParent: 1472705d773f5abab68768ab7dc30aaecf1e7223
Files changed
client/config.js | changed |
client/modules/key.js | changed |
client/config.js | ||
---|---|---|
@@ -5,22 +5,22 @@ | ||
5 | 5 … | |
6 | 6 … | module.exports = function () { |
7 | 7 … | |
8 | 8 … | // set a default ws.remote if there is none, overrideable in the client |
9 | - if ((localStorage.remote === undefined) || (localStorage.remote === '')) { | |
9 … | + if ((localStorage[config.path + '/remote'] === undefined) || (localStorage[config.path + '/remote'] === '')) { | |
10 | 10 … | http.get('http://localhost:3379', function (res) { |
11 | 11 … | res.on('data', (ws) => { |
12 | - localStorage.remote = ws | |
12 … | + localStorage[config.path + '/remote'] = ws | |
13 | 13 … | }) |
14 | 14 … | }).on('error', (e) => { |
15 | 15 … | console.log(e.message); |
16 | - localStorage.remote = config.ws.remote | |
16 … | + localStorage[config.path + '/remote'] = config.ws.remote | |
17 | 17 … | }) |
18 | 18 … | } |
19 | 19 … | |
20 | 20 … | var remote = 'undefined' === typeof localStorage |
21 | 21 … | ? null //'ws://localhost:8989~shs:' + require('./keys') |
22 | - : localStorage.remote | |
22 … | + : localStorage[config.path + '/remote'] | |
23 | 23 … | |
24 | 24 … | //var remote = config.ws.remote |
25 | 25 … | |
26 | 26 … | //TODO: use _several_ remotes, so if one goes down, |
client/modules/key.js | ||
---|---|---|
@@ -33,11 +33,11 @@ | ||
33 | 33 … | location.reload() |
34 | 34 … | }}, 'Delete Key') |
35 | 35 … | ), |
36 | 36 … | h('hr'), |
37 | - h('p', {innerHTML: 'Your Decent websocket remote is: <pre>' + localStorage.remote + '</pre>'}, | |
37 … | + h('p', {innerHTML: 'Your Decent websocket remote is: <pre>' + localStorage[config.path + '/remote'] + '</pre>'}, | |
38 | 38 … | h('button.btn.btn-danger', {onclick: function (e){ |
39 | - localStorage.remote = '' | |
39 … | + localStorage[config.path + '/remote'] = '' | |
40 | 40 … | alert('Your remote pub has been deleted') |
41 | 41 … | e.preventDefault() |
42 | 42 … | location.hash = "" |
43 | 43 … | location.reload() |
@@ -58,9 +58,9 @@ | ||
58 | 58 … | h('hr'), |
59 | 59 … | importRemote, |
60 | 60 … | h('button.btn.btn-success', {onclick: function (e){ |
61 | 61 … | if(importRemote.value) { |
62 | - localStorage.remote = importRemote.value | |
62 … | + localStorage[config.path + '/remote'] = importRemote.value | |
63 | 63 … | e.preventDefault() |
64 | 64 … | alert('Your websocket remote has been updated') |
65 | 65 … | } |
66 | 66 … | location.hash = "" |
Built with git-ssb-web