git ssb

3+

ev / decent



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 PM
Parent: 1472705d773f5abab68768ab7dc30aaecf1e7223

Files changed

client/config.jschanged
client/modules/key.jschanged
client/config.jsView
@@ -5,22 +5,22 @@
55
66 module.exports = function () {
77
88 // 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'] === '')) {
1010 http.get('http://localhost:3379', function (res) {
1111 res.on('data', (ws) => {
12- localStorage.remote = ws
12 + localStorage[config.path + '/remote'] = ws
1313 })
1414 }).on('error', (e) => {
1515 console.log(e.message);
16- localStorage.remote = config.ws.remote
16 + localStorage[config.path + '/remote'] = config.ws.remote
1717 })
1818 }
1919
2020 var remote = 'undefined' === typeof localStorage
2121 ? null //'ws://localhost:8989~shs:' + require('./keys')
22- : localStorage.remote
22 + : localStorage[config.path + '/remote']
2323
2424 //var remote = config.ws.remote
2525
2626 //TODO: use _several_ remotes, so if one goes down,
client/modules/key.jsView
@@ -33,11 +33,11 @@
3333 location.reload()
3434 }}, 'Delete Key')
3535 ),
3636 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>'},
3838 h('button.btn.btn-danger', {onclick: function (e){
39- localStorage.remote = ''
39 + localStorage[config.path + '/remote'] = ''
4040 alert('Your remote pub has been deleted')
4141 e.preventDefault()
4242 location.hash = ""
4343 location.reload()
@@ -58,9 +58,9 @@
5858 h('hr'),
5959 importRemote,
6060 h('button.btn.btn-success', {onclick: function (e){
6161 if(importRemote.value) {
62- localStorage.remote = importRemote.value
62 + localStorage[config.path + '/remote'] = importRemote.value
6363 e.preventDefault()
6464 alert('Your websocket remote has been updated')
6565 }
6666 location.hash = ""

Built with git-ssb-web